1

EWS マネージ API 2.0 を使用して予定を作成しています。それは正常に動作します。ただし、既存の予定も更新したい。どのアポイントを編集する必要があるかを指定するには、アポイント ID が必要であると読みました。しかし、IDはどこにありますか?

予定を作成する方法は次のとおりです。

        'Creates the Appointment
        Dim appointment As New EWS.Appointment(esb)
        appointment.Subject = txtThema.Text
        appointment.Body = txtBemerkung.Text
        appointment.Start = Von
        appointment.End = Bis
        appointment.Location = lbRaumInfo.Text

        'Adds the Attendees
        For i = 1 To emaillist.Length - 1
            appointment.RequiredAttendees.Add(emaillist(i))
        Next

        'Sending
        appointment.Save(EWS.SendInvitationsMode.SendToAllAndSaveCopy)
4

2 に答える 2

2

の一時的な一意の ID は、プロパティAppointmentItemを介して取得できます。を保存した後に存在するはずです。ItemSchema's IdAppointmentItem

ItemId id = appointment.Id;

を移動またはコピーすると、ItemIdが変わる可能性がAppointmentItemあります。

于 2012-12-21T04:07:07.900 に答える
2

それを行う方法は、SilverNinja によって提案された一意の ID を使用することです。彼が言ったように、これは永続的な ID ではなく、予定が別のフォルダーに移動されると変更される可能性があります (たとえば、削除された場合など)。 .

この問題に対処する方法は、拡張プロパティを作成し、予定に GUID を設定することです。これは、別の予定からコピーを作成しない限り変更されません (結局のところ、それは単なるプロパティです)。

私は C# でそれを持っていますが、VB に変換するのはかなり簡単だと確信しています。

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;
} 
于 2012-12-21T08:44:40.797 に答える