none
EWS Managed API: Public Folders: folder.Permissions is always empty RRS feed

  • Question

  • Hi there

    I use EWS Managed API (the latest Version from yesterday but i had the same error with the previous version) to create public folders and modify permissions. We Have Exchange 2007 SP1.

    Everything works fine so far except: When I query a folder with FindFolders the Permissions are always empty.
    The folder.Permissions Variable itself is not null but it just does not contain any permissions.
    So if i add Permissions with folder.Permissions.Add() all existing permissions get removed...

    I know that there are permission because I see them in Outlook.

    I have enough rights to do it because using the Powershell call Get-PublicFolderClientPermission succeeds and as I said I am even able to set Permission.

    Calling folder.GetLoadedPropertyDefinitions() returns

    -  folder.GetLoadedPropertyDefinitions() Count = 7 System.Collections.ObjectModel.Collection<Microsoft.Exchange.WebServices.Data.PropertyDefinitionBase>
    +  [0] {Id} Microsoft.Exchange.WebServices.Data.PropertyDefinitionBase {Microsoft.Exchange.WebServices.Data.ComplexPropertyDefinition<Microsoft.Exchange.WebServices.Data.FolderId>}
    +  [1] {ParentFolderId} Microsoft.Exchange.WebServices.Data.PropertyDefinitionBase {Microsoft.Exchange.WebServices.Data.ComplexPropertyDefinition<Microsoft.Exchange.WebServices.Data.FolderId>}
    +  [2] {DisplayName} Microsoft.Exchange.WebServices.Data.PropertyDefinitionBase {Microsoft.Exchange.WebServices.Data.StringPropertyDefinition}
    +  [3] {ChildFolderCount} Microsoft.Exchange.WebServices.Data.PropertyDefinitionBase {Microsoft.Exchange.WebServices.Data.IntPropertyDefinition}
    +  [4] {EffectiveRights} Microsoft.Exchange.WebServices.Data.PropertyDefinitionBase {Microsoft.Exchange.WebServices.Data.EffectiveRightsPropertyDefinition}
    +  [5] {Permissions} Microsoft.Exchange.WebServices.Data.PropertyDefinitionBase {Microsoft.Exchange.WebServices.Data.PermissionSetPropertyDefinition}
    +  [6] {ExtendedProperties} Microsoft.Exchange.WebServices.Data.PropertyDefinitionBase {Microsoft.Exchange.WebServices.Data.ComplexPropertyDefinition<Microsoft.Exchange.WebServices.Data.ExtendedPropertyCollection>}

    So it looks like Permissions are included by default, or are they not?

    What am i doing wrong?

    I event tried

    folder.TryGetProperty(FolderSchema.Permissions, out o);

    the calls succeeds but the Permission Collection is still empty!

    Kind regards

    Philipp

    Tuesday, June 19, 2012 3:36 PM

All replies

  • I got it working if I use Folder.Bind() again on the FolderID I found using FindFolders()....

    All i wanna do is something simple like: Add permission to a folder /a/b/c

    But what i have to do is in fact:

    -Bind to well known folder public folder root
    -root.FindFolders(a)
    -a.FindFolders(b)
    -b.FindFolders(c)
    folder=Folder.Bind(c.Id)
    folder.Permissions.Add()...

    is there no simpler way to do this? I mean its 3xFindfolders and 2xBind just to get the actual folder....

    Tuesday, June 19, 2012 4:01 PM
  • You dont need the first bind  you can do the initial search just using the FolderId and the WellKnown Enum, but because you can't do a deep-traversal you need the rest of the FindFolder operations.

    If your using this in some sort of context and you can get the HexId from Outlook or the Exchange Management Shell then you can use ConvertID and avoid the search.

    Cheers
    Glen

    Wednesday, June 20, 2012 6:25 AM