How to use TranslateExchangeIds in VB

Louis Hillebrand 0 Reputation points
2023-11-21T15:53:24.43+00:00

I am trying to convert the MSGraph ContactIds to a format I can use in EWS to manage contact groups (Contact groups are not implemented in MS graph).

  • Graph_Client connects to Exchange, I can read/write all the contact data
  • Owner is the email-address from the owner of the mailbox
  • MyContact is an existing contact.

.PostAsync is marked as an obsolete method, it notifies me to use PostAsTranslateExchangeIdsPostResponseAsync.

When I try to run this code I get a Microsoft.Graph.Models.ODataErrors.ODataError

Anyone has a solution for me?

        Dim InputData As New List(Of String)
        InputData.Add(MyContact.Id)

        Dim requestBody As New Users.Item.TranslateExchangeIds.TranslateExchangeIdsPostRequestBody With {
            .InputIds = InputData,
            .SourceIdType = ExchangeIdFormat.RestId,
            .TargetIdType = ExchangeIdFormat.EwsId
        }

        'Return Await Graph_Client.Users(Owner).TranslateExchangeIds.PostAsync(requestBody)
		Return Await Graph_Client.Users(Owner).TranslateExchangeIds.PostAsTranslateExchangeIdsPostResponseAsync(requestBody)
Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
11,401 questions
0 comments No comments
{count} votes