Re: Modify exchange security descriptor
- From: "Tom Rizzo [MSFT]" <thomriz@xxxxxxxxxxxxx>
- Date: Fri, 13 May 2005 16:19:32 -0700
You could use the security module in the SDK. It has the correct code to
set security. You may be setting ACLs incorrectly and should follow the
format the module uses.
Tom
--
Looking for a good book on programming Exchange, Outlook, ADSI and
SharePoint? Check out http://www.microsoft.com/MSPress/books/5517.asp
This posting is provided "AS IS" with no warranties, and confers no rights.
<glefla@xxxxxxxxx> wrote in message
news:1115676807.532615.183480@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
>I am trying to chage the owner of an appointment using WebDAV. The
> code returns a success message but when I read the XML for the security
> descriptor again there are no changes. Here is my code:
>
> string strUri =
> "http://server/exchange/ConferenceRoom/calendar/Test.EML";
> StringBuilder sbSecurityXml = new StringBuilder();
>
> sbSecurityXml.Append("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
> sbSecurityXml.Append("<D:propertyupdate xmlns:D=\"DAV:\"
> xmlns:S=\"http://schemas.microsoft.com/exchange/security/\">");
> sbSecurityXml.Append("<D:set>");
> sbSecurityXml.Append("<D:prop>");
> sbSecurityXml.Append("<D:descriptor>");
> sbSecurityXml.Append("<S:security_descriptor
> xmlns:S=\"http://schemas.microsoft.com/security/\"
> xmlns:D=\"urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882/\"
> D:dt=\"microsoft.security_descriptor\" S:from_mapi_tlh=\"1\">");
> sbSecurityXml.Append("<S:revision>1</S:revision>");
> sbSecurityXml.Append("<S:owner S:defaulted=\"0\">");
> sbSecurityXml.Append("<S:sid>");
> sbSecurityXml.Append("<S:string_sid>S-1-5-21-182476959-1673274735-1050887974-57530</S:string_sid>");
> sbSecurityXml.Append("<S:type>user</S:type>");
> sbSecurityXml.Append(@"<S:nt4_compatible_name>domain\user</S:nt4_compatible_name>");
> sbSecurityXml.Append("<S:ad_object_guid>{dbc91f86-da61-4ee3-add4-98b11b843bf4}</S:ad_object_guid>");
> sbSecurityXml.Append("<S:display_name>Test user</S:display_name>");
> sbSecurityXml.Append("</S:sid>");
> sbSecurityXml.Append("</S:owner>");
> sbSecurityXml.Append("</S:security_descriptor>");
> sbSecurityXml.Append("</D:descriptor>");
> sbSecurityXml.Append("</D:prop>");
> sbSecurityXml.Append("</D:set>");
> sbSecurityXml.Append("</D:propertyupdate>");
>
> Uri uriPath = new Uri(strUri);
> HttpWebRequest request = (HttpWebRequest) WebRequest.Create(uriPath);
>
> NetworkCredential credential = new NetworkCredential("uid", "pwd",
> "domain");
> CredentialCache cache = new CredentialCache();
> cache.Add(uriPath, "basic", credential);
> request.Credentials = cache;
> request.KeepAlive = false;
> request.Headers.Set("Pragma", "no-cache");
> request.ContentType = "text/xml";
> request.Headers.Set("Translate", "f");
> request.Headers.Set("Depth", "0");
> request.ContentLength = sbSecurityXml.ToString().Length;
> request.Timeout = 300000;
> request.Method = "PROPPATCH";
>
> Byte[] bytes =
> System.Text.Encoding.ASCII.GetBytes(sbSecurityXml.ToString());
> request.ContentType = "text/xml";
> request.ContentLength = bytes.Length;
> Stream requestStream = request.GetRequestStream();
> requestStream.Write(bytes, 0, bytes.Length);
> requestStream.Close();
>
> HttpWebResponse response = (HttpWebResponse) request.GetResponse();
> string strStatus = response.StatusCode.ToString();
>
> Stream responseStream = response.GetResponseStream();
> Encoding encode = System.Text.Encoding.GetEncoding("utf-8");
> StreamReader reader = new StreamReader(responseStream, encode);
> string strResponseText = reader.ReadToEnd();
>
> responseStream.Close();
> request = null;
> response = null;
> cache = null;
> credential = null;
> responseStream = null;
> reader = null;
>
> This code returns 207 (success) but does not make any changes to the
> XML.
>
> Can anyone tell me what is causing this problem? According to this
> sample from the SDK
> (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/e2k3/e2k3/_exch2k_web_storage_system_security.asp)
> it can be done.
>
> Thanks in advance.
>
.
- References:
- Modify exchange security descriptor
- From: glefla
- Modify exchange security descriptor
- Prev by Date: Bounced Email listener using WebDav
- Next by Date: Re: Problems with confirm reading
- Previous by thread: Modify exchange security descriptor
- Next by thread: Send is not a member of CDO.Message
- Index(es):
Relevant Pages
|