EWS:日历共享邀请和扩展属性

本文关键字:扩展 属性 日历 共享 EWS | 更新日期: 2023-09-27 18:29:41

好的,到目前为止,我得到的关于这个主题的最好信息是关于这个线程的:EWS-API-创建日历和具有查看权限的共享。我试着在那个帖子上问这个问题,但实际上我把它作为答案发布了,所以它被管理员删除了(我的错!)

免责声明:我是一名系统管理员,从事贸易和兼职开发。。。因此,请原谅任何误用术语或言语上的混淆。

此外,我在C#中工作。

我已经阅读了微软的消息协议规范,并了解到需要在消息项上创建某些扩展属性才能正确创建共享邀请对象。我从上面提到的帖子中了解到,我可以创建具有扩展属性的消息对象(确切地说是SetExtendedProperty(extprop,value))。我知道我必须使用new ExtendedProperty()手动创建我正在设置的扩展属性,并在每个属性上填充正确的Parent GUID、HexID和Datatype。据我所知,这或多或少是一种"变通方法",因为API中没有内置固有的共享对象管理功能。。。

但我遇到了一个障碍,需要澄清一下。。。

我想手动创建一个共享邀请(通过客户端,即"用户"方式),然后附加到发送邀请的用户的"已发送邮件"框中的邮件。我想列举所有可能的属性,相对于构建类似对象所需的属性,这样我就可以将其用作模板,并将我的对象属性与原始邀请进行比较。我可以很好地得到消息,并找到许多属性,但没有任何"特殊"属性。我能发现的唯一区别消息项的是它是IPM.Sharing项类,并且它有一个sharing_metadata.xml附件。

但是,我现在假设我们可以通过使用扩展属性通过API创建共享邀请,这不一定意味着我们可以通过API读取这些属性,这是正确的吗??

我试图枚举的所有扩展属性似乎都不起作用,并且总是不返回任何内容,而是返回一个扩展属性数组。也许我做得不对,但我想在花无数个小时试图实现一些不可能的事情之前先问这个问题。

所以,如果我不能正确地枚举扩展属性,是否有可能使用ExFoldersMFCMAPI之类的东西来获得这些属性???

有什么想法/建议/批评吗?

谢谢!

更新:

这是我正在玩的功能,可以尝试为用户日历文件夹创建共享邀请。。。我评论了我被卡住的地方和我没有完全理解的地方:

    public void CreateCalendarSharingRequest(string folderID, string owner, string sharedToUser)
    {
        // LOAD OUR CUSTOM PROPERTIES
        Guid PropertySetSharing = new Guid("{00062040-0000-0000-C000-000000000046}");
        Guid PropertySetInternetHeaders = new Guid("{00020386-0000-0000-C000-000000000046}");
        // Sharing Properties
        ExtendedPropertyDefinition PidLidSharingProviderGuid = new ExtendedPropertyDefinition(PropertySetSharing, 0x8A01, MapiPropertyType.CLSID);
        ExtendedPropertyDefinition PidLidSharingProvidorName = new ExtendedPropertyDefinition(PropertySetSharing, 0x8A02, MapiPropertyType.String);
        ExtendedPropertyDefinition PidLidSharingFlavor = new ExtendedPropertyDefinition(PropertySetSharing, 0x8A18, MapiPropertyType.Integer);
        ExtendedPropertyDefinition PidLidSharingRemoteStoreUid = new ExtendedPropertyDefinition(PropertySetSharing, 0x8A48, MapiPropertyType.String);
        ExtendedPropertyDefinition PidLidSharingRemoteUid = new ExtendedPropertyDefinition(PropertySetSharing, 0x8A06, MapiPropertyType.String);
        ExtendedPropertyDefinition PidTagMessageClass = new ExtendedPropertyDefinition(0x001A, MapiPropertyType.String);
        ExtendedPropertyDefinition PidTagNormalizedSubject = new ExtendedPropertyDefinition(0x0E1D, MapiPropertyType.String);
        ExtendedPropertyDefinition PidTagSubjectPrefix = new ExtendedPropertyDefinition(0x003D, MapiPropertyType.String);
        ExtendedPropertyDefinition PidLidSharingCapabilities = new ExtendedPropertyDefinition(PropertySetSharing, 0x8A17, MapiPropertyType.Integer);
        ExtendedPropertyDefinition PidLidSharingInitiatorEntryId = new ExtendedPropertyDefinition(PropertySetSharing, 0x8A09, MapiPropertyType.Binary);
        ExtendedPropertyDefinition PidLidSharingConfigurationUrl = new ExtendedPropertyDefinition(PropertySetSharing, 0x8A24, MapiPropertyType.String);
        ExtendedPropertyDefinition PidLidSharingInitiatorName = new ExtendedPropertyDefinition(PropertySetSharing, 0x8A07, MapiPropertyType.String);
        ExtendedPropertyDefinition PidLidSharingInitiatorSMTP = new ExtendedPropertyDefinition(PropertySetSharing, 0x8A08, MapiPropertyType.String);
        ExtendedPropertyDefinition PidLidSharingLocalType = new ExtendedPropertyDefinition(PropertySetSharing, 0x8A14, MapiPropertyType.String);
        ExtendedPropertyDefinition PidLidSharingRemoteType = new ExtendedPropertyDefinition(PropertySetSharing, 0x8A1D, MapiPropertyType.String);
        ExtendedPropertyDefinition PidLidSharingRemoteName = new ExtendedPropertyDefinition(PropertySetSharing, 0x8A05, MapiPropertyType.String);
        // Internet Header Properties
        ExtendedPropertyDefinition PidNameContentClass = new ExtendedPropertyDefinition(PropertySetInternetHeaders, "Content-Class", MapiPropertyType.String);
        ExtendedPropertyDefinition PidNameXSharingCapabilities = new ExtendedPropertyDefinition(PropertySetInternetHeaders, "X-Sharing-Capabilities", MapiPropertyType.String);
        ExtendedPropertyDefinition PidNameXSharingConfigUrl = new ExtendedPropertyDefinition(PropertySetInternetHeaders, "X-Sharing-Config-Url", MapiPropertyType.String);
        ExtendedPropertyDefinition PidNameXSharingFlavor = new ExtendedPropertyDefinition(PropertySetInternetHeaders, "X-Sharing-Flavor", MapiPropertyType.String);
        ExtendedPropertyDefinition PidNameXSharingLocalType = new ExtendedPropertyDefinition(PropertySetInternetHeaders, "X-Sharing-Local-Type", MapiPropertyType.String);
        ExtendedPropertyDefinition PidNameXSharingRemoteName = new ExtendedPropertyDefinition(PropertySetInternetHeaders, "X-Sharing-Remote-Name", MapiPropertyType.String);
        ExtendedPropertyDefinition PidNameXSharingRemoteStoreUid = new ExtendedPropertyDefinition(PropertySetInternetHeaders, "X-Sharing-Remote-Store-Uid", MapiPropertyType.String);
        ExtendedPropertyDefinition PidNameXSharingRemoteType = new ExtendedPropertyDefinition(PropertySetInternetHeaders, "X-Sharing-Remote-Type", MapiPropertyType.String);
        ExtendedPropertyDefinition PidNameXSharingRemoteUid = new ExtendedPropertyDefinition(PropertySetInternetHeaders, "X-Sharing-Remote-Uid", MapiPropertyType.String);
        ExtendedPropertyDefinition PidNameXSharingProviderGuid = new ExtendedPropertyDefinition(PropertySetInternetHeaders, "X-Sharing-Provider-Guid", MapiPropertyType.String);
        ExtendedPropertyDefinition PidNameXSharingProviderName = new ExtendedPropertyDefinition(PropertySetInternetHeaders, "X-Sharing-Provider-Name", MapiPropertyType.String);
          // Bind to the web services and currently selected folder
        // Get the current list of delegates for this folder
        ExchangeService service = GetExchangeService();
        // Create a new message
        EmailMessage invitationRequest = new EmailMessage(service);
        invitationRequest.Subject = "I'd like to share my calendar with you";
        invitationRequest.Body = "Send by Exchange Administrator on behalf of user";
        invitationRequest.From = GetSMTPAddress(owner);
        invitationRequest.ItemClass = "IPM.Sharing";
        invitationRequest.SetExtendedProperty(PidNameContentClass, "Sharing");
        invitationRequest.SetExtendedProperty(PidTagMessageClass, "IPM.Sharing");
        invitationRequest.SetExtendedProperty(PidLidSharingFlavor,0x20310); /* Indicates Invitation for a special folder */
        invitationRequest.SetExtendedProperty(PidNameXSharingFlavor, "20310"); /* Text representation of SharingFlavor value */
        invitationRequest.SetExtendedProperty(PidLidSharingProviderGuid, PropertySetSharing.ToString());
        invitationRequest.SetExtendedProperty(PidNameXSharingProviderGuid, PropertySetSharing.ToString());
        invitationRequest.SetExtendedProperty(PidLidSharingCapabilities, 0x40290); /* value for Special Folders */
        invitationRequest.SetExtendedProperty(PidNameXSharingCapabilities, "40290"); /* Test representation of SharingCapabilities value */
        // THIS IS WHERE IM STUCK - I understand how to set some of the properties like above, but then
        // it starts needing the entryID properties for the folder being shared, etc...and I'm not entirely
        // sure which properties I have to set and how many can/will be autopopulated by the transport provider
        // All i wanna do is send an invite message for sharing the calendar folder from one user to another!
        // Add recipient info
        //invitationRequest.ToRecipients.Add(sharedToUser);
        //invitationRequest.SendAndSaveCopy();
    }

EWS:日历共享邀请和扩展属性

我想好了。。。但这并不容易。如果您对我如何通过Exchange 2010的EWS API 1.2发送共享邀请感兴趣,您可以在这里阅读