Giter Club home page Giter Club logo

Comments (6)

grahamr975 avatar grahamr975 commented on May 30, 2024

@Backmischung,

I hope you're doing well.

I'm able to replicate this issue in my own environment. Specific contacts produce the "GivenName" error, but not to all mailboxes.

2021/03/02 16:40:12 INFO Updating Contact: [email protected]
PS>TerminatingError(Set-EXCContactObject): "The property 'GivenName' cannot be found on this object. Verify that the property exists and can be set."
2021/03/02 16:40:13 ERROR Failed to sync [email protected] contact to [email protected]'s mailbox The property 'GivenName' cannot be found on this object. Verify that the property exists and can be set.

GivenName is one of the properties of the Contact EWS class. You can find more info here: https://docs.microsoft.com/en-us/dotnet/api/microsoft.exchange.webservices.data.contact?view=exchange-ews-api

Since (in my experience) the error only occurs when updating contacts, we know that we're dealing with contact objects fetched from a user's mailbox. You can see the line below from Sync-ContactList.ps1.
$MailboxContacts = Get-EXCContactsObject -MailboxName $Mailbox -Credentials $Credential -Folder $ContactsFolderObject -service $service | Where-Object {$null -ne $_.EmailAddresses[[Microsoft.Exchange.WebServices.Data.EmailAddressKey]::EmailAddress1].Address}

I'll need to do some testing. Unfortunately, I've been busy with other projects and will need some time to come back to this.

from ews-office365-contact-sync.

Backmischung avatar Backmischung commented on May 30, 2024

Hello again,

just a little update: the error kept persisting but deleting the created folder and initiating a new sync solved the issue (as expected).

A way to remotely deleting the created folder would be a nice tool for troubleshooting in general.

Best regards
Adrian

from ews-office365-contact-sync.

Backmischung avatar Backmischung commented on May 30, 2024

Update: The same error keeps occuring.
Deleting the synced folder is just a temporary solution, also hard to keep up with multiple mailboxes.

from ews-office365-contact-sync.

wayfarerfin avatar wayfarerfin commented on May 30, 2024

I had same issue with update function, but i noticed it only happens if there is duplicate contact on destination folder.

from ews-office365-contact-sync.

wayfarerfin avatar wayfarerfin commented on May 30, 2024

I just added following if before set-exccontactobject. It's not pretty, but does following and doesn't crash to "Given name" error.

If more than one contact found with same email addres, this picks first one and deletes it and update second one.

For some reason it just delete on first run and update on second run. But without "$ContactObject = $result2" job crashes. So, it's not pretty and may need tweaking, but working its own ugly way ;)

###edit. Replaced - first 2 to - last 1 😉


write-host "Contact count on contacts folder with same email address $kontaktiwindowsemailaddress :" $ContactObject.count

Delete if double"

if ($ContactObject.Count -gt 1){

$result = $ContactObject | select-object -first 1

$result2 = $ContactObject | select-object -last 1

write-host "Duplicate found, deleting $result"

$result.Delete([Microsoft.Exchange.WebServices.Data.DeleteMode]::SoftDelete)

$ContactObject = $result2

}

try {

Set-EXCContactObject -MailboxName $Ma....

from ews-office365-contact-sync.

grahamr975 avatar grahamr975 commented on May 30, 2024

@wayfarerfin Thanks for explaining this issue and writing out some sample code to fix it. I just addressed this in the last commit 7cb0b30. Please update and see the changelog for more information.

from ews-office365-contact-sync.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.