user1077685
user1077685

Reputation:

Exchange - Programmatically Created Mailbox Can't Access Users' Calendars

I've been using a web application I've written to remotely create users/mailboxes on my Exchange server. However, users created using this method have been unable to see other users' calendar information within the same organization. Did I forget some important parameter?

I'm almost certainly not following best practices, but I essentially craft a command and send that to the Exchange powershell for my organization, like so:

Dim runspace As Runspace
runspace = ConnectToExchange()

Dim command = New Command("New-Mailbox")
command.Parameters.Add("Name", firstName & " " & lastName)
command.Parameters.Add("Alias", userName)
command.Parameters.Add("OrganizationalUnit", ou)
command.Parameters.Add("UserPrincipalName", userName & "@" & domainName)
command.Parameters.Add("SamAccountName", userName)
command.Parameters.Add("FirstName", firstName)
command.Parameters.Add("Initials", "")
command.Parameters.Add("LastName", lastName)
command.Parameters.Add("Password", securePassword)
command.Parameters.Add("ResetPasswordOnNextLogon", True)
command.Parameters.Add("Database", db)
command.Parameters.Add("AddressBookPolicy", abp)

runspace.Open()
Dim pipeline = runspace.CreatePipeline()
pipeline.Commands.Add(command)

' Execute the command
Dim results = pipeline.Invoke()

runspace.Dispose()

I should mention that I've reviewed the docs, but the only thing that stands out to me is the Sharing Policy parameter. Reviewing now..

EDIT: I have the same Sharing Policy applied as a test user I've just created. I can view others calendars, but the test user cannot.

SECOND EDIT: I ran the following cmdlets for both my normal account (which can see calendars) and the test account (which cannot see calendars):

Get-Mailbox identity.here | Format-List * | Out-File C:\Users\MyName\Desktop\file.txt

I then ran these through a diff tool and found the differences. There was nothing notable that would cause this issue! I don't know where to turn to next.

Upvotes: 1

Views: 803

Answers (1)

Paul
Paul

Reputation: 5861

please run the following CMDlet on both accounts:

Get-MailboxFolderPermission -Identity [email protected]:\Calendar

Please note that the "Calendar" part seems to depend on your Exchange installation language (in German its "Kalender" for example).

If i get you right your account probably has AccessRights:{PublishingEditor} set. If so run the following CMDlet on the account that doesnt have access:

Set-MailboxFolderPermission -Identity [email protected]:\Calendar -User Default -AccessRights Reviewer

Hope that helps

Paul

Upvotes: 1

Related Questions