admin管理员组文章数量:1279042
I've done a great deal of googling, stack searching, and I cannot seem to find a way to update/patch an item using Graph API (specifically attempting to update an email message) to remove a MultiValueExtendeProperty. With EWS there was a function "RemoveExtendedProperty" from the object. With Graph API, I cannot seem to find a way to "delete", "clear" or otherwise remove the MultiValueExtendedProperty(s). Does anyone know of a way to leverage Graph API as we have to switch off EWS due to their login system changing.
Example Snippet
var gmc = new GraphMailClient(auth);
var account = "[email protected]";
var idval = "somemessageidyoucanlookupandedit";
var start = await gmc.Users[account].Messages[idval].Request().GetAsync();
start.MultiValueExtendedProperties = new MessageMultiValueExtendedPropertiesCollectionPage()
{
new MultiValueLegacyExtendedProperty() { Id = "StringArray {66f5a359-4659-4830-9070-00049ec6ac6e} Name MVE1", Value = new string[] { "test" } },
new MultiValueLegacyExtendedProperty() { Id = "StringArray {66f5a359-4659-4830-9070-00049ec6ac6e} Name MVE2", Value = new string[] { DateTime.Now.AddMinutes(3).ToString() } }
};
var saveDraftId = await gmc.SaveDraftAsync(account, start);
var entry = await gmc.Users[account].Messages[idval].Request().Expand("multiValueExtendedProperties($filter = id eq 'StringArray {66f5a359-4659-4830-9070-00049ec6ac6e} Name MVE1' or id eq 'StringArray {66f5a359-4659-4830-9070-00049ec6ac6e} Name MVE2'), attachments").GetAsync();
entry.MultiValueExtendedProperties.RemoveAt(0);
entry.MultiValueExtendedProperties.Clear();
var result = await gmc.Users[account].Messages[idval].Request().Expand("multiValueExtendedProperties($filter = id eq 'StringArray {66f5a359-4659-4830-9070-00049ec6ac6e} Name MVE1' or id eq 'StringArray {66f5a359-4659-4830-9070-00049ec6ac6e} Name MVE2'), attachments").UpdateAsync(entry);
var entryAgain = await gmc.Users[account].Messages[idval].Request().Expand("multiValueExtendedProperties($filter = id eq 'StringArray {66f5a359-4659-4830-9070-00049ec6ac6e} Name MVE1' or id eq 'StringArray {66f5a359-4659-4830-9070-00049ec6ac6e} Name MVE2'), attachments").GetAsync();
if(entryAgain.MultiValueExtendedProperties.Any())
Console.WriteLine("Failed");
Thanks
I've done a great deal of googling, stack searching, and I cannot seem to find a way to update/patch an item using Graph API (specifically attempting to update an email message) to remove a MultiValueExtendeProperty. With EWS there was a function "RemoveExtendedProperty" from the object. With Graph API, I cannot seem to find a way to "delete", "clear" or otherwise remove the MultiValueExtendedProperty(s). Does anyone know of a way to leverage Graph API as we have to switch off EWS due to their login system changing.
Example Snippet
var gmc = new GraphMailClient(auth);
var account = "[email protected]";
var idval = "somemessageidyoucanlookupandedit";
var start = await gmc.Users[account].Messages[idval].Request().GetAsync();
start.MultiValueExtendedProperties = new MessageMultiValueExtendedPropertiesCollectionPage()
{
new MultiValueLegacyExtendedProperty() { Id = "StringArray {66f5a359-4659-4830-9070-00049ec6ac6e} Name MVE1", Value = new string[] { "test" } },
new MultiValueLegacyExtendedProperty() { Id = "StringArray {66f5a359-4659-4830-9070-00049ec6ac6e} Name MVE2", Value = new string[] { DateTime.Now.AddMinutes(3).ToString() } }
};
var saveDraftId = await gmc.SaveDraftAsync(account, start);
var entry = await gmc.Users[account].Messages[idval].Request().Expand("multiValueExtendedProperties($filter = id eq 'StringArray {66f5a359-4659-4830-9070-00049ec6ac6e} Name MVE1' or id eq 'StringArray {66f5a359-4659-4830-9070-00049ec6ac6e} Name MVE2'), attachments").GetAsync();
entry.MultiValueExtendedProperties.RemoveAt(0);
entry.MultiValueExtendedProperties.Clear();
var result = await gmc.Users[account].Messages[idval].Request().Expand("multiValueExtendedProperties($filter = id eq 'StringArray {66f5a359-4659-4830-9070-00049ec6ac6e} Name MVE1' or id eq 'StringArray {66f5a359-4659-4830-9070-00049ec6ac6e} Name MVE2'), attachments").UpdateAsync(entry);
var entryAgain = await gmc.Users[account].Messages[idval].Request().Expand("multiValueExtendedProperties($filter = id eq 'StringArray {66f5a359-4659-4830-9070-00049ec6ac6e} Name MVE1' or id eq 'StringArray {66f5a359-4659-4830-9070-00049ec6ac6e} Name MVE2'), attachments").GetAsync();
if(entryAgain.MultiValueExtendedProperties.Any())
Console.WriteLine("Failed");
Thanks
Share Improve this question asked Feb 24 at 2:15 ChrisChris 294 bronze badges1 Answer
Reset to default 0To remove the MultiValueExtendedProperty
property, send PATCH request, but leave the value of the MultiValueExtendedProperty
property empty.
var message = new Message
{
MultiValueExtendedProperties = new MessageMultiValueExtendedPropertiesCollectionPage()
{
new MultiValueLegacyExtendedProperty() { Id = "StringArray {66f5a359-4659-4830-9070-00049ec6ac6e} Name MVE2", Value = new string[] { } }
}
};
var result = await gmc.Users[account].Messages[idval].Request().UpdateAsync(message);
本文标签: Graph API Clear MultiValueExtendedPropertiesStack Overflow
版权声明:本文标题:Graph API Clear MultiValueExtendedProperties - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741296999a2370874.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论