gpt4 book ai didi

c# - Attendee.ResponseType 未知 - Exchange 托管 API

转载 作者:太空宇宙 更新时间:2023-11-03 16:22:10 24 4
gpt4 key购买 nike

我在尝试获取作为预约所需参加者的房间的 ResponseType 时遇到问题。我可以确认我的 exchange 2010 sp2 ru4 服务器立即批准或拒绝 session ,但是当我以编程方式使用 ExchangeManaged api 查找约会时,相关的所需与会者总是返回 ResponseType 的“未知”值。

这是我的代码...

 public bool IsAppointmentVerifiedWithResource(Patron userSessionObj, Reservation reservation)
{
var emailConfig = new DataStoreManager.ConfigurationManager();
var serviceBinding = emailConfig.GetConfiguration(Configuration.GetConfigurationName(Resource_ConfigurationConstants.ExchangeServiceBinding));

// Create the binding.
var service = new ExchangeService(ExchangeVersion.Exchange2010_SP2)
{
UseDefaultCredentials = true,
Url = new Uri(serviceBinding)
};

// Set the calendar view to use
var view = new CalendarView(reservation.Start, reservation.End);

// Get the target folder ID using the email address
var folder = new FolderId(WellKnownFolderName.Calendar, new Mailbox(reservation.EmailAddress));

view.PropertySet = new PropertySet(BasePropertySet.FirstClassProperties);

if (CheckForApptCount(service, folder, view))
{
var response = service.FindAppointments(folder, view);

service.LoadPropertiesForItems(from Item item in response select item, BasePropertySet.FirstClassProperties);

foreach (Appointment apt in response.Items)
{
foreach(Attendee at in apt.RequiredAttendees)
{
//room mailbox matches required attendee
if(at.Address == reservation.EmailAddress)
{
******at.ResponseType always = Unknown******
if(at.ResponseType == MeetingResponseType.Accept)
{
return true;
}
}
}
}

}

return false;

}

关于如何同步和加载 ResponseType 属性有什么想法吗?

谢谢,克里斯

*********************更新 - 寻找组织者约会*********************

    public List<Appointment> RetrieveExistingReservations(DateTime selectedDate)
{
var service = new ExchangeService()
service.ImpersonatedUserId = new ImpersonatedUserId(ConnectingIdType.SmtpAddress, "yourorganizer@whatever.com");

using (WindowsIdentity.Impersonate(service.ImpersonatedUserId))
{
return EwsWrapper.GetStandardCalendarItems(service, selectedDate, selectedDate.AddDays(30));
}
}

public static List<Appointment> GetStandardCalendarItems(ExchangeService service, DateTime dtStart, DateTime dtEnd)
{
// Instantiate a collection to hold occurrences and exception calendar items.
List<Appointment> foundAppointments = new List<Appointment>();

// Initialize values for the start and end times, and the number of appointments to retrieve.
DateTime startDate = dtStart.AddDays(-1);
DateTime endDate = startDate.AddDays(30);

//// Create a calendar view to search the calendar folder and specify the properties to return.
CalendarView calView = new CalendarView(startDate, endDate)
{
PropertySet = new PropertySet(BasePropertySet.FirstClassProperties)
};

// Retrieve a collection of calendar items.
FindItemsResults<Appointment> findResults = service.FindAppointments(WellKnownFolderName.Calendar, calView);

// Add all calendar items in your view that are occurrences or exceptions to your collection.
foreach (Appointment appt in findResults.Items)
{


foundAppointments.Add(appt);

}

return foundAppointments;
}

最佳答案

找到的解决方案:与会者的 ResponseType 始终为空,因为我正在为与会者的邮箱执行“findappointments”,然后尝试获取该与会者的 ResponseType。获取与会者 ResponseType 的正确方法是为组织者的邮箱运行“findappointments”。找到约会后,枚举与会者,ResponseType 将可用。

关于c# - Attendee.ResponseType 未知 - Exchange 托管 API,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13570239/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com