我正在使用C#和Exchange Web服務API,並且一直無法找到使用名爲Account的擴展屬性檢索聯繫人的方法。我們使用這個字段來保存一個整數,這對於內部開發的系統是有意義的。在WebDAV下,我們知道如何檢索聯繫人,但需要一些幫助(希望是一個簡短的示例或代碼片段)來演示如何執行此操作。Exchange Web Services - 如何使用帳戶擴展屬性檢索聯繫人
0
A
回答
0
我已經使用約會的擴展屬性,所以也許他們工作在與聯繫人相同的概念。
這個想法是爲約會提供指導,因爲他們的本地ID不是固定的。
private static readonly PropertyDefinitionBase AppointementIdPropertyDefinition = new ExtendedPropertyDefinition(DefaultExtendedPropertySet.PublicStrings, "AppointmentID", MapiPropertyType.String);
public static PropertySet PropertySet = new PropertySet(BasePropertySet.FirstClassProperties, AppointementIdPropertyDefinition);
//Setting the property for the appointment
public static void SetGuidForAppointement(Appointment appointment)
{
try
{
appointment.SetExtendedProperty((ExtendedPropertyDefinition)AppointementIdPropertyDefinition, Guid.NewGuid().ToString());
appointment.Update(ConflictResolutionMode.AlwaysOverwrite, SendInvitationsOrCancellationsMode.SendToNone);
}
catch (Exception ex)
{
// logging the exception
}
}
//Getting the property for the appointment
public static string GetGuidForAppointement(Appointment appointment)
{
var result = "";
try
{
appointment.Load(PropertySet);
foreach (var extendedProperty in appointment.ExtendedProperties)
{
if (extendedProperty.PropertyDefinition.Name == "AppointmentID")
{
result = extendedProperty.Value.ToString();
}
}
}
catch (Exception ex)
{
// logging the exception
}
return result;
}
0
不知道,如果你仍然需要這個......但我只是解決了一些接近自己:
我answer here應該在你想要的球場。我在這裏使用布爾值以及帳戶:
ExchangeService service = this.GetService(); // my method to build service
FolderId folderID = GetPublicFolderID(service, "My Address Book");
ContactsFolder folder = ContactsFolder.Bind(service, folderID);
int folderCount = folder.TotalCount;
var guid = DefaultExtendedPropertySet.PublicStrings;
var epdAccount = new ExtendedPropertyDefinition(0x3A00, MapiPropertyType.String);
var epdCID = new ExtendedPropertyDefinition(0x3A4A, MapiPropertyType.String);
var epdCBLN = new ExtendedPropertyDefinition(guid, "CustomBln", MapiPropertyType.Boolean);
var epdCDBL = new ExtendedPropertyDefinition(guid, "CustomDbl", MapiPropertyType.Double);
var view = new ItemView(folderCount);
view.PropertySet = new PropertySet(BasePropertySet.FirstClassProperties);
view.PropertySet.Add(epdAccount);
view.PropertySet.Add(epdCID);
view.PropertySet.Add(epdCBLN);
view.PropertySet.Add(epdCDBL);
//var searchOrFilterCollection = new List<SearchFilter>();
//searchOrFilterCollection.Add(new SearchFilter.IsEqualTo(epdCBLN, true));
//searchOrFilterCollection.Add(new SearchFilter.IsEqualTo(epdAccount, "user"));
//var filter = new SearchFilter.SearchFilterCollection(LogicalOperator.And, searchOrFilterCollection);
var filter = new SearchFilter.IsEqualTo(epdAccount, "user");
var contacts = service.FindItems(folderID, filter, view);
foreach (Contact contact in contacts)
{
string Account;
int CID;
bool CBLN;
double CDBL;
contact.GetLoadedPropertyDefinitions();
contact.TryGetProperty(epdAccuont, out Account);
contact.TryGetProperty(epdCID, out CID);
contact.TryGetProperty(epdCBLN, out CBLN);
contact.TryGetProperty(epdCDBL, out CDBL);
Console.WriteLine(String.Format("{0, -20} - {1} - {2} - {3} - {4}"
, contact.DisplayName
, contact.EmailAddresses[EmailAddressKey.EmailAddress1]
, Account
, CID
, CBLN
, CDBL
));
}
相關問題
- 1. 使用EWS和PowerShell從聯繫人中檢索擴展屬性
- 2. 如何使用php從Microsoft Exchange Server檢索組和聯繫人?
- 3. 如何使用Microsoft Exchange Web Services檢索會議表單在同一個域中的其他聯繫人?
- 4. 從Microsoft Exchange Server 2003檢索聯繫人
- 5. 如何檢索聯繫人的所有可用帳戶?
- 6. Outlook聯繫人屬性和Active Directory/Exchange
- 7. Exchange Web Services通知
- 8. EWS - 如何知道聯繫人字段的擴展屬性ID?
- 9. 如何使用聯繫人ID檢索聯繫人圖片
- 10. 如何使用Exchange Web服務(EWS)訪問聯繫人的PostOfficeBox?
- 11. 如何使用MS EWS託管API檢索全局聯繫人?
- 12. Android聯繫人帳戶
- 13. 通過擴展屬性查詢Google API聯繫人
- 14. 從不同的郵件帳戶中檢索聯繫人?
- 15. 從電話簿檢索這些聯繫人有社交帳戶
- 16. Android:以編程方式檢索帳戶的聯繫人
- 17. 檢索所有已連接特定帳戶的聯繫人
- 18. 使用gdata.contacts.client和oauth2檢索聯繫人
- 19. 如何將聯繫人組添加到Exchange-2007電子郵件帳戶?
- 20. 使用Zend檢索Google聯繫人
- 21. 如何獲取或向用戶添加聯繫人Exchange郵箱?
- 22. 從聯繫人獲取關聯帳戶?
- 23. 從C檢索SQL Server擴展屬性#
- 24. 如何檢索「標準」Android聯繫人
- 25. 如何檢索聯繫人的生日?
- 26. 如何檢索單個聯繫人
- 27. Exchange Web Services:UseDefaultCredentials屬性
- 28. Exchange Web Services託管API:如何通過FindItem方法執行循環擴展?
- 29. 如何從Android的Exchange Server獲取聯繫人列表?
- 30. 如何使用EWS Java API(Exchange Web服務)設置聯繫人Email1DisplayName?