问题
I'm having some trouble on creating and share a calendar with review permissions using Exchange Webservice API .NET.
At the moment this is my code:
Folder addCalendar = new Folder(service);
addCalendar.DisplayName = name;
addCalendar.FolderClass = "IPF.Appointment";
var perm = new FolderPermission(new UserId("reviewer@test.com"),
FolderPermissionLevel.Reviewer);
addCalendar.Permissions.Add(perm);
addCalendar.Save(WellKnownFolderName.MsgFolderRoot);
The calendar is created, in my account I can see the calendar and the user 'reviewer@test.com' has the correct permissions.
The problem is: The calendar doesn't show at the reviewer's account.
回答1:
I figured out how to programmatically send a sharing invitation within an organization through EWS. May not answer all your questions, but it's a good start to understanding how in-depth you gotta get to actually do it. Heres the link
回答2:
You have to do two things:
Set the appropiate permissions:
var folder = Folder.Bind(service, WellKnownFolderName.Calendar);
folder.Permissions.Add(new FolderPermission("someone@yourcompany.com",
FolderPermissionLevel.Reviewer));
folder.Update();
Then, send an invitation message. Now, this is the hard part. The message format is specifified in [MS-OXSHARE]: Sharing Message Object Protocol Specification. The extended properties are defined in [MS-OXPROPS]: Exchange Server Protocols Master Property List. You need to create a message according to that specification and send it to the recipient.
EDITED:
To set the sharing properties on the element, use extended properties.
First, define the properties. For example, the PidLidSharingProviderGuidProperty is defined as follows:
private static readonly Guid PropertySetSharing = new Guid("{00062040-0000-0000-C000-000000000046}");
private static readonly ExtendedPropertyDefinition PidLidSharingProviderGuidProperty = new ExtendedPropertyDefinition(PropertySetSharing, 0x8A01, MapiPropertyType.CLSID);
private static readonly ExtendedPropertyDefinition ConversationIdProperty = new ExtendedPropertyDefinition(0x3013, MapiPropertyType.Binary);
You can then set the property on a new item using the SetExtendedProperty method:
item.SetExtendedProperty(PidLidSharingProviderGuidProperty, "somevalue");
来源:https://stackoverflow.com/questions/7503613/ews-api-create-calendar-and-share-with-reviewer-permissions