110,536
社区成员
发帖
与我相关
我的任务
分享
public void DownloadAttachments(string itemID, string folder)
{
ExchangeServiceBinding esb = new ExchangeServiceBinding();
PathToUnindexedFieldType[] ptufta = new PathToUnindexedFieldType[2];
ptufta[0] = new PathToUnindexedFieldType();
ptufta[0].FieldURI = UnindexedFieldURIType.itemAttachments;
ptufta[1] = new PathToUnindexedFieldType();
ptufta[1].FieldURI = UnindexedFieldURIType.itemHasAttachments;
ItemResponseShapeType irst = new ItemResponseShapeType();
irst.BaseShape = DefaultShapeNamesType.IdOnly;
irst.AdditionalProperties = ptufta;
ItemIdType[] biita = new ItemIdType[1];
biita[0] = new ItemIdType();
biita[0].Id = itemID;
//get the items
GetItemType git = new GetItemType();
git.ItemShape = irst;
git.ItemIds = biita;
GetItemResponseType girt = esb.GetItem(git);//这句抛出异常:调用 Send 方法之前必须设置 Path 属性。
if (girt.ResponseMessages.Items[0].ResponseClass != ResponseClassType.Success)
return;
/*…………………………………………*/