c# - Set DateTimeCreate with EWS Proxy classes -


is possible change creationdatetime, sentdatetime, etc.????

i`m tring create/update message. run fine, need set field itemtype.createdatetime values (eg. need create message has time creation not today, year ego). have next code:

//update created item             itemidtype itemid = new itemidtype();             itemid.id = savedmessageid;             itemid.changekey = savedmessagechangekey;              itemtype setcreatedt = new itemtype();             setcreatedt.datetimecreated = new system.datetime(2000, 10, 10, 12, 12, 12);             setcreatedt.datetimecreatedspecified = true;              setitemfieldtype setitemfield = new setitemfieldtype();             setitemfield.item = new pathtounindexedfieldtype();             (setitemfield.item pathtounindexedfieldtype).fielduri = unindexedfielduritype.itemdatetimecreated;             setitemfield.item1 = setcreatedt;              updateitemtype request = new updateitemtype();             request.itemchanges = new itemchangetype[1] { new itemchangetype() };             request.itemchanges[0].item = itemid;             request.itemchanges[0].updates = new itemchangedescriptiontype[1];             request.itemchanges[0].updates[0] = setitemfield;             request.messagedisposition = messagedispositiontype.saveonly;             request.messagedispositionspecified = true;              updateitemresponsetype updateitemresponse = m_mailbox.updateitem(request); 

that request return error: "set action invalid property."

if im tring change subject, run ok.

[update] found next solution, doesn`t work. there using extended properties , ids.

pathtoextendedfieldtype q = new pathtoextendedfieldtype();         q.propertyid = 3590; //deliverytime         q.propertytype = mapipropertytypetype.systemtime;         q.propertyidspecified = true;         newitem.extendedproperty[0] = new extendedpropertytype();         newitem.extendedproperty[0].extendedfielduri = q;         newitem.extendedproperty[0].extendedfielduri.distinguishedpropertysetidspecified = true;         newitem.extendedproperty[0].item = new system.datetime(2013, 5, 5, 5, 5, 5).tostring("yyyy-mm-ddthh:mm:ssz"); 

...

createitemresponsetype createitemresponse = m_mailbox.createitem(createitemtype); 

it works fine, don`t see changes..

second solution correct, there mistakes. 1) it's better access properties propertytag. 2) should set propertytag , propertytype.

here working code:

itemtype newitem = xmlparser.loaditem(); //info newitem takes xml         newitem.extendedproperty = new extendedpropertytype[1];         pathtoextendedfieldtype q = new pathtoextendedfieldtype();         q.propertytag = "3590"; //deliverytime         q.propertytype = mapipropertytypetype.systemtime;         newitem.extendedproperty[0] = new extendedpropertytype();         newitem.extendedproperty[0].extendedfielduri = q;         newitem.extendedproperty[0].item = new system.datetime(2014, 5, 5, 5, 5, 5).tostring("yyyy-mm-ddthh:mm:ssz"); 

Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -