EWS (ExchangeWebService)와 연락처를 동기화하도록 작성된 서비스를 유지 관리하고 있습니다. 이 서비스는 최근에 작동을 멈춘 contactpictures를 업데이트하고 있습니다.첨부 파일을 삭제할 때 Exchange 오류가 발생합니다.
그것은 단지 "덮어 쓰기"바로 그겁니다contact.SetContactPicture(filePath);
contact.Update(ConflictResolutionMode.AlwaysOverwrite); // throws the excpetion
contactpicture, 예전 먼저 내부적으로 삭제됩니다 따라서 오류 메시지가 보인다 던져 예외는 DeleteAttachmentException 처음
코드가이 모습입니다 맞아.
그래서 내가 수동으로 soloution되지 않습니다 먼저 삭제, 의 확인을 시도 중 하나를 새 연락처를 만들 때이 잘 작동if(contact.HasPicture)
{
contact.RemoveContactPicture();
contact.Update(ConflictResolutionMode.AlwaysOverwrite); // throws the Exception
}
. 그것은 Contactpicture를 표시합니다. 그러나 기존의 것들이 업데이트되지 않습니다.
슬프게도 예외는 많은 정보를 제공 나던 :Microsoft.Exchange.WebServices.Data.DeleteAttachmentException ist aufgetreten.
_HResult=-2146233088
_message=At least one attachment couldn't be deleted.
HResult=-2146233088
IsTransient=false
Message=At least one attachment couldn't be deleted.
Source=Microsoft.Exchange.WebServices
StackTrace:
Microsoft.Exchange.WebServices.Data.AttachmentCollection.InternalDeleteAttachments(IEnumerable`1 attachments)
InnerException:
모든 것은 (사서함 소유자) 정보 UserContext에서 실행됩니다.
UPDATE
나는 완전히 첨부 파일이 ContactPicture이든, 여전히 같은 결과인지 independet을했다 :
_item이 (로드 된)를 ExchangeItem입니다
public void UpdateAttachment(string attachmentPath, string attachmentName)
{
Attachment attachment = _item.Attachments.SingleOrDefault(att => String.Equals(att.Name, attachmentName, StringComparison.OrdinalCultureIgnoreCase));
if (attachment != null)
{
_item.Attachments.Remove(attachment);
_item.Update(ConflictResolutionMode.AlwaysOverwrite);
}
attachment = _item.Attachments.AddFileAttachment(attachmentName, attachmentPath);
_item.Update(ConflictResolutionMode.AlwaysOverwrite);
}
나는 대신 _item.Load()를 호출하여이를 더티 픽스했다. 목록 작성자를 구현 한 후 내일 질문을 업데이트하십시오. (전체 구현은 큰 혼란이 있으므로 약간의 시간이 걸릴 수 있습니다.) – CSharpie
이상하게 작동합니다. 어쨌든 나는 다음 번에 그 모든 tracelistnerthing을 구현했다. 고맙습니다. – CSharpie