0 votes

How would a script be written that accomplishes the following task? In this scenario, UserA would be selected with the Modify user action, then UserB would be input to add required permissions. If it would be possible to select or search for "UserB" instead of inputting "UserB" that would be a more desireable solution.

Add-MailboxFolderPermission -Identity UserA:\Calendar -User UserB -AccessRights reviewer

I've already created a homepage action with a customized imput, although being able to browse to select the user object, or search for the user object would be nicer. Now I'm attempting to complete the business rule that runs the script to allow reviewer permissions on UserA's calendar for UserB

by (350 points)

1 Answer

0 votes
by (216k points)
selected by
Best answer

Hello Michael,

Judging by the screenshot that you sent us the script that you were testing for this task has a couple of issues.

First of all, in your script you call the $Context.SetModifiedPropertyValue method with only one argument, which is incorrect. The method should be called with two arguments: $Context.SetModifiedPropertyValue("<property_name>", <new_property_value>). Also, there is another error when an Exchange management cmdlet fails due to a missing parameter.

I suspect that you just confused the $Context.SetModifiedPropertyValue and the $Context.GetModifiedPropertyValue methods in your script. Can you post the full text of your script here so we can resolve the issue?

0

I'm sure there are things missing or incorrect from my script. Scripting isn't one of my stronger skillsets

add-pssnapin Microsoft.Exchange.Management.PowerShell.E2010
$username = "%username%"
$Context.GetModifiedPropertyValue("CustomAttributeText1")
Add-MailboxFolderPermission -Identity %username%:\Calendar -User %CustomAttributeText1% -AccessRights reviewer
$Context.SetModifiedPropertyValue("CustomAttributeText1",$NULL)

0

Michael,

Here's the modified script. Now it should work:

Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010
$identity = "%username%\Calendar"
$calendarReviewerUserName = $Context.GetModifiedPropertyValue("adm-customAttributeText1")
Add-MailboxFolderPermission -Identity $identity -User $calendarReviewerUserName -AccessRights reviewer
$Context.SetModifiedPropertyValue("adm-customAttributeText1",$NULL)
0

Thanks very much! Worked like a charm!

Related questions

0 votes
1 answer

Hi, I need a script that will retrospectively create a sub-folder on file server's shared folder with following permissions: employee his/hers manager (taken from AD) specific ... for more pre-existing users that don't have them. Thanks for any feedback.

asked Nov 3, 2020 by roberttryba (70 points)
0 votes
1 answer

We are developing a process to mange mailboxes for terminated users. At the time of termination we would like to: convert the mailbox to a shared mailbox. Send an approval ... would run script to grant the manger access to the mailbox. Can this be done?

asked Oct 27, 2023 by mightycabal (1.0k points)
0 votes
1 answer

I would like to know if it is possible to create a field in the web UI under user management to "assign" a machine to a user. I would like to be able to put the ... be moved to "workstation OU. Is there s custome field that can be used to accomplish this?

asked Oct 22, 2020 by copatterson (70 points)
0 votes
0 answers

Hi, I have a question in regard to https://www.adaxes.com/questions/13241/mail-enabled-security-group-not-found-in-o365 My rule is creating shared mailbox and ... www.adaxes.com/script-repository/check-whether-user-has-mailbox-in-exchange-online-s303.htm)?

asked Jul 18, 2023 by wintec01 (1.1k points)
0 votes
0 answers

Hello. I'd like add the ability for people to remove full access to a mailbox, while not allowing them to grant access. I've come up with a hacky way to ... via the exchange delegation properties of the web interface. Any help would be appreciated. Thanks!

asked Jul 25, 2016 by EgotisticalGiraffe (350 points)
3,348 questions
3,049 answers
7,791 comments
545,047 users