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 (215k 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

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

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)
0 votes
1 answer

Hello Support We are in need of a process that will disable/delete the user mailbox after 30 days of deprovisioning a user. We already use Mailtip and forward email to the ... but sync from On Prem to Cloud only. Thank you as always for your support. Jay

asked Oct 11, 2017 by willy-wally (3.2k points)
0 votes
1 answer

Hi, Does someone already have a script that I can run as a scheduled task that will email a list of enabled active directory accounts that have exchange mailboxes? I ... First, Middle, Last, Title, Location and Email address. Any assistance is appreciated.

asked Feb 2, 2017 by mdedmon (150 points)
2,779 questions
2,512 answers
6,574 comments
26,506 users