실제로 이것은 EWS Managed API를 사용하는 사람들이 직면하는 매우 일반적인 문제입니다.
이유가 무엇인지 모르겠지만 약속이 다른 폴더로 이동하면 고유 ID가 변경됩니다.
은 그래서 당신이 시도 할 수있는 것은 (그것이 약속의 경우)은 작업중인 폴더에 대한 귀하의 GUID /가 UniqueID을 선언하고 매번 당신이 어디에 ExtendesPropertyDefinition
이 folder.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;
}
어떻게하면 같은 폴더로 식별 할 수 있습니까? 그래서 두 사용자의 1 폴더에 대해 1 GUID? – Unlockedluca
정확합니다. 두 ID는 모두 같은 폴더 (예 : 공용 폴더/Myfolders/Folder1)에 대한 표현입니다. 따라서 경로 자체는 고유 ID이지만 이름 변경으로 인해 불변하지 않습니다. – MartinHappyCoding