Hi
I am using following code to change the message read/unread status. In
response this code create new mail only with subject and their is no change
in message read/unread status.
Can you please help me in this.
thanks in advance
Here is the code
try
{
MyCredentialCache = new System.Net.CredentialCache();
MyCredentialCache.Add(new System.Uri(sUri),
"NTLM",
new System.Net.NetworkCredential(strUserName, strPassword,
strDomain)
);
// TODO: Replace with the URL of an object in Exchange Server
System.Uri myUri = new System.Uri(sUri);
HttpWRequest = (HttpWebRequest)WebRequest.Create(myUri);
// Add the network credentials to the request.
HttpWRequest.Credentials = MyCredentialCache;
string sQuery;
sQuery = "<?xml version='1.0'?>"
+ " <D:propertyupdate
xmlns:b='urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882/'
xmlns:e='urn:schemas:httpmail:' xmlns:z='urn:schemas:mailheader:'
xmlns:c='xml:' xmlns:f='http://schemas.microsoft.com/exchange/'
xmlns:g='urn:schemas-microsoft-com:office:office'
xmlns:h='http://schemas.microsoft.com/repl/'
xmlns:i='urn:schemas-microsoft-com:exch-data:' xmlns:D='DAV:'>"
+ " <D:set><D:prop><e:read
b:dt='boolean'>1</e:read></D:prop></D:set>"
+ " </D:propertyupdate>";
// Set Headers
HttpWRequest.KeepAlive = true;
HttpWRequest.Headers.Set("Pragma", "no-cache");
//HttpWRequest.Headers.Set("Translate", "f");
HttpWRequest.ContentType = "text/xml";
HttpWRequest.ContentLength = sQuery.Length;
//set the request timeout to 5 min.
HttpWRequest.Timeout = 300000;
// set the request method
HttpWRequest.Method = "PROPPATCH";
// You must store the data in a byte array
byte[] ByteQuery = System.Text.Encoding.ASCII.GetBytes(sQuery);
HttpWRequest.ContentLength = ByteQuery.Length;
Stream QueryStream = HttpWRequest.GetRequestStream();
// Write the data to be posted to the Request Stream
QueryStream.Write(ByteQuery, 0, ByteQuery.Length);
QueryStream.Close();
// Send Request and Get Response
HttpWebResponse HttpWResponse =
(HttpWebResponse)HttpWRequest.GetResponse();
// Get the Status code
int iStatCode = (int)HttpWResponse.StatusCode;
string sStatus = iStatCode.ToString();
Console.WriteLine("Status Code: {0}", sStatus);
// Get the request headers
string sReqHeaders = HttpWRequest.Headers.ToString();
Output += sReqHeaders;
// Read the Response Stream
Stream strm = HttpWResponse.GetResponseStream();
StreamReader sr = new StreamReader(strm);
string sText = sr.ReadToEnd();
Output += "\n Response: {0}"+ sText;
strm.Close();
MyCredentialCache = null;
HttpWRequest = null;
HttpWResponse = null;
QueryStream = null;
strm = null;
sr = null;
}
catch (Exception e)
{
Output = "\n {0} Exception caught." + e.Message;
}
Post by sameenCan you please guide me how can i use this flag (PR_MESSAGEFLAGS) from C#
WebDAV Application?
Post by sameenHow you please guide me how can i use this flag (PR_MESSAGEFLAGS) from C#
WebDAV Application?
Post by LukeYeah, I tried that too. Eventually I figured out that adding "no-cache"
headers to all my requests fixed everything.
Post by Henning Krause [MVP - Exchange]Hello,
try to set bit 0 of http://schemas.microsoft.com/mapi/proptag/xe070003
(PR_MESSAGEFLAGS) to 1.
Haven't tried that, but looks promising.
Best regards,
Henning Krause
I'm using WebDAV on Exchange 2003. I am looking for unread messages with
attachments then downloading those attachments. This part works fine.
The
problem is that setting the "urn:schemas:httpmail:read" attribute seems to
do
nothing. It doesn't mark read messages as unread and it doesn't mark
unread
messages as read. The PROPPATCH response indicates success, but it is not
reflected in the store on the server. I spent hours looking at various
resources, but couldn't find anything. What could be causing this?