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

Hello Adaxes Support, is there any way you could help me with a script that changes the permissions on a users home folder? I need to remove the permission to delete the folder and add the permission to delete subfolders and files.

asked Aug 1 by dominik.stawny (280 points)
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

Hello Adaxes Support, I couldn't find a script to enable MessageCopyForSentAsEnabled for a shared mailbox, do you have a script for me to do that?

asked May 22 by dominik.stawny (280 points)
0 votes
1 answer

Good afternoon, Is there a script for adding a user to an already existing Office 365 Shared Mailbox? I want to add this script onto the onboarding rules I have added already.

asked May 7 by ocanizales (60 points)
3,547 questions
3,238 answers
8,232 comments
547,809 users