I am using below API to get the contact which was deleted from App Database after stopping Service.
graphClient.User[emailId]
.Contacts
.Request()
.Filter($"singleValueExtendedProperties/Any(ep: ep/id eq '{GlobalConstants.PrimaryKeyMapiId}')")
.Expand($"singleValueExtendedProperties($filter=id eq '{GlobalConstants.PrimaryKeyMapiId}')" )
.GetAsync()
.Result;
Its throwing exception , Please sugest what will be the solution for this
CodePudding user response:
You can omit .Filter()
method because the filter itself is specified in .Expand()
method
graphClient.User[emailId]
.Contacts
.Request()
.Expand($"singleValueExtendedProperties($filter=id eq '{GlobalConstants.PrimaryKeyMapiId}')" )
.GetAsync()
.Result;
CodePudding user response:
string a = "String {66f5a359-4659-4830-9070-00040ec6ac6e} Name Fun";
var res = await graphClient.Users["tinywang@tenant_name.onmicrosoft.com"]
.Contacts
.Request()
.Filter($"singleValueExtendedProperties/Any(ep: ep/id eq '{a}' and ep/value eq 'Food')").GetAsync();
Per my searching, when we want to add a filter on singleValueExtendedProperties
, then we can follow
Then per my test, if I sent a request like https://graph.microsoft.com/v1.0/users/user_id/contacts?$filter=singleValueExtendedProperties/Any(ep: ep/id eq 'String {66f5a359-4659-4830-9070-00040ec6ac6e} Name Fun')
it will had issue like below
So we have to call api like this: https://graph.microsoft.com/v1.0/users/user_id/contacts?$filter=singleValueExtendedProperties/Any(ep: ep/id eq 'String {66f5a359-4659-4830-9070-00040ec6ac6e} Name Fun' and ep/value eq 'Food')