• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 60
  • Last Modified:

Error deleting existing multivalued parameter from an Office 365 Contact using Set-Contact cmdlet

Q: How can I update existing O365 Contacts to remove some, or all, of the values associated with a multivalued parameter (e.g., OtherTelephone and OtherHomePhone.)

Using Powershell Exchange Set-Contact cmdlet with Office 365

For other parameters, simply specifying an empty string value to a SetContact parameter is sufficient to update them to empty.

For multivalued parameters, using something like -OtherTelephone "" as the parameter produces:

Set-Contact -Identity example@yahoo.com -ErrorAction Continue -WarningAction SilentlyContinue -OtherTelephone "" -TelephoneAssistant "123-456-7890" -Office "" -Pager "" -HomePhone "123-456-7891" -Title "Records Ch" -Notes "" -OtherHomePhone "" -Fax "" -Initials "ZY" -Department "" -StreetAddress "1234 My Lane" -PostalCode "12345-1234" -MobilePhone "123-456-7892" -StateOrProvince "DC" -Company "" -City "Cityname" -Phone ""

Active Directory operation failed on DM3PR12A003DC04.NAMPR12A003.PROD.OUTLOOK.COM. This error is not retriable.        
Additional information: The attribute specified in the operation is not present on the object.                          
Active directory response: 00002076: AtrErr: DSID-030F18BB, #2:                                                                
   0: 00002076: DSID-030F18BB, problem 1001 (NO_ATTRIBUTE_OR_VAL), data 0, Att 20115 (otherHomePhone)                      
   1: 00002076: DSID-030F18BB, problem 1001 (NO_ATTRIBUTE_OR_VAL), data 0, Att 20012 (otherTelephone)                  
+ CategoryInfo          : NotSpecified: (:) [Set-Contact], ADOperationException                                        
+ FullyQualifiedErrorId : [Server=CY4PR1201MB0199,RequestId=16e078fa-23f1-44d9-89ab-8d0df28628ec,TimeStamp=2/8/201    
8 10:09:21 PM] [FailureCategory=Cmdlet-ADOperationException] 4B85200D,Microsoft.Exchange.Management.RecipientTasks    
.SetContact                                                                                                              
  + PSComputerName        : outlook.office365.com
0
fmoultrie
Asked:
fmoultrie
  • 2
  • 2
2 Solutions
 
Vasil Michev (MVP)Commented:
Since it's a multi-value, "" will only work when it's non-empty. Either check for the value, or simply use the following notation to quick add/remove:

Set-Contact temp -OtherTelephone @{add="+123"}
Set-Contact temp -OtherTelephone @{remove="+123"}

Open in new window

0
 
fmoultrieAuthor Commented:
That's helpful, but not fully what I need. I am replacing a series of contact fields and am trying to just set the new values without comparing each to the previous (which can be done, but doesn't appear trivial to implement).

In this case, the specified replacement string is empty and I'd like to just blindly replace the existing field value (e.g., the OtherTelephone value, whether empty or not) with an empty value.

I suppose I could retrieve the contact information, loop through the multi-value fields in the contact, and iteratively @{remove="each"}. I would much prefer to just be able to reset a contact multi-value field in a single operation.

Is there anything like the related AD operation such as an @{clear} or other way to reset a multi-value field regardless of current value? Or, would the iterative @{remove approach be simple to implement? (example appreciated, if so)

Thanks!
0
 
Vasil Michev (MVP)Commented:
Simply set it to $null then.

Set-Contact temp -OtherTelephone $null

Open in new window

1
 
fmoultrieAuthor Commented:
Thank you!!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Simplify Active Directory Administration

Administration of Active Directory does not have to be hard.  Too often what should be a simple task is made more difficult than it needs to be.The solution?  Hyena from SystemTools Software.  With ease-of-use as well as powerful importing and bulk updating capabilities.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now