ClaudeWalker
asked on
EWS Autodiscover not working, cycle through calendar items
I'm trying to create a program that cycles through all user calendars and records their calendar items. However, I can't seem to do anything other than access my calendar. I'm the Systems Administrator and have access to all admin accounts and admin network credentials.
How can I get a user's (other than mine) calendar items? I get autodiscover errors so I am putting in the service URL directly.
Thanks,
JOe K.
How can I get a user's (other than mine) calendar items? I get autodiscover errors so I am putting in the service URL directly.
Thanks,
JOe K.
//THIS WORKS
ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010_SP1);
service.UseDefaultCredentials = true;
service.Url = new Uri ("https://mydomain/EWS/Exchange.asmx");
Appointment appointment = new Appointment(service);
appointment.Subject = "Dentist Appointment";
appointment.Body = "The appointment is with Dr. Smith.";
appointment.Start = new DateTime(2012, 1, 3, 9, 0, 0);
appointment.End = appointment.Start.AddHours(2);
appointment.Save(SendInvitationsMode.SendToNone);
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You must left all the data as the way you wrote it except for "serviceAccount" that must be your account (your user name into the domain, the one which you log in with).
Hope that helps.
Hope that helps.
ASKER
I'm still getting the same error even after adding that to EMS.
Here is my code:
Here is what I used to enable impersonation: New-ManagementRoleAssignme nt –Name:impersonationAssignm entName –Role:ApplicationImpersona tion –User:userLogin
Here is my code:
Here is what I used to enable impersonation: New-ManagementRoleAssignme
ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010_SP1);
service.Url = new Uri("https://myDomain.com/EWS/Exchange.asmx");
service.ImpersonatedUserId = new ImpersonatedUserId(ConnectingIdType.SmtpAddress, "userLogin@myDomain.com");
Folder folder = Folder.Bind(service, WellKnownFolderName.Calendar);
Console.WriteLine(folder.DisplayName);
ASKER
Sorry about the tabbing in the embedded code.
ASKER
Nevermind, this was the issue: Console.WriteLine(folder.D isplayName );
I can get Console.WriteLine(folder.I d); to work instead meaning its connecting.
I can get Console.WriteLine(folder.I
ASKER
Now I have access to the calendar folder for all users
how can I grab the calendar items using folder.???
how can I grab the calendar items using folder.???
Does Console.WriteLine(folder.I d) works?
ASKER
Yes. I got it!
foreach (Item item in calendar.FindItems(new ItemView(100)))
{
Console.WriteLine(item.Sub ject);
}
I was able to cycle through all of the items in a calendar. Now I can put some date conditions in and loop through a number of email addresses.
Perfect!
Thank you soooo much!
JOe K.
foreach (Item item in calendar.FindItems(new ItemView(100)))
{
Console.WriteLine(item.Sub
}
I was able to cycle through all of the items in a calendar. Now I can put some date conditions in and loop through a number of email addresses.
Perfect!
Thank you soooo much!
JOe K.
Glad to help you!!
Greetings and happy new year!
Greetings and happy new year!
ASKER
Per the documentation to enable it for all users:
New-ManagementRoleAssignme
However, I don't know what the parameters are supposed to me :
impersonationAssignmentNam
ApplicationImpersonation (Is this meant to be as is)
serviceAccount (is this an email account, sharedTest@mydomain.com)
I'm close...
Thanks,
JOe K.