2015-01-20 1 views
0

나는 이상한 문제가 발생하고있다 : 나는 (가 Exchange 2010 공용 폴더에) 바로 그 폴더를 볼 때 나는 두 개의 서로 다른 사용자에 대해 두 개의 서로 다른 UniqueIDs를 얻을 :EWS : 동일한 공용 폴더에 고유 한 고유 ID가 있습니까?

그것을 ID에는 사용자 관련 부분과 공통 부분이 모두 포함되어있는 것으로 보입니다. 그것들을 같은 폴더로 어떻게 식별 할 수 있습니까?

편집 : 일부 시스템에서는 폴더의 FolderID.UniqueID가 모든 사용자에게 동일합니다.

+0

어떻게하면 같은 폴더로 식별 할 수 있습니까? 그래서 두 사용자의 1 폴더에 대해 1 GUID? – Unlockedluca

+0

정확합니다. 두 ID는 모두 같은 폴더 (예 : 공용 폴더/Myfolders/Folder1)에 대한 표현입니다. 따라서 경로 자체는 고유 ID이지만 이름 변경으로 인해 불변하지 않습니다. – MartinHappyCoding

답변

2

나는 당신이 항상 공용 폴더에 부합 될 것 대신 https://msdn.microsoft.com/en-us/library/ee178895(v=exchg.80).aspx이를 PR_SOURCE_KEY 확장 속성을 사용하는 것이 좋습니다 것입니다 그리고 당신은 또한 아웃룩 플러그인

건배 폴더에 액세스 할 MAPI에서이 속성을 사용할 수 있습니다 글렌

1

실제로 이것은 EWS Managed API를 사용하는 사람들이 직면하는 매우 일반적인 문제입니다.

이유가 무엇인지 모르겠지만 약속이 다른 폴더로 이동하면 고유 ID가 변경됩니다.

은 그래서 당신이 시도 할 수있는 것은 (그것이 약속의 경우)은 작업중인 폴더에 대한 귀하의 GUID /가 UniqueID을 선언하고 매번 당신이 어디에 ExtendesPropertyDefinitionfolder.update 또는 appointment.update 당신이 당신의 extendedPropertyDefinition를 전달할 수 있습니다 설정 update() 방법.

그냥 폴더 (폴더 약속을 대체하고 어떻게 든 작동합니다 :))

개인 정적 읽기 전용 PropertyDefinitionBase AppointementIdPropertyDefinition = 새로운 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

imtes에 데이터를 추가하는 것은 옵션이 아니지만 귀하의 도움에 감사드립니다. – MartinHappyCoding