none
[E2016] [EWSMA] [C#] [Linux]: Getting access denied error when creating new public contacts folder

    Question

  • Hi!

    Trying to create new public contacts folder on fresh exchange server 2016 via administrator account

    var folder = new ContactsFolder(_service);
    folder.DisplayName = "foobar";
    await folder.Save(WellKnownFolderName.PublicFoldersRoot);

    Getting exception 

    Unhandled Exception: Microsoft.Exchange.WebServices.Data.ServiceResponseException: Access is denied. Check credentials and try again., Could not create folder PublicContacts.
       at Microsoft.Exchange.WebServices.Data.ServiceResponse.InternalThrowIfNecessary()
       at Microsoft.Exchange.WebServices.Data.MultiResponseServiceRequest`1.<ExecuteAsync>d__6.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at Microsoft.Exchange.WebServices.Data.Folder.<Save>d__17.MoveNext()

    Which permissions should be set to allow creation of public folders?

    Friday, July 6, 2018 1:02 AM

Answers

  • Your trying to create the folder in the Root of Public folder Store using a Mailbox API which nobody including Administrators have permissions to do by default (Admins are allowed to do this via the EAC and EMS via RBAC delegation but this is a different API). You will need to grant the account your trying to use access to create folders under the root to be able to do that (using the EAC). Or better create a folder under the Root using the EAC then grant yourself permission to that folder and then test your code against that folder. 

    Cheers
    Glen

    • Marked as answer by Vaporif Tuesday, July 10, 2018 3:04 PM
    Friday, July 6, 2018 4:10 AM