php-ews exchange 2007 room calendar events - exchange-server

We're on exchange 2007 and I'm using php-ews and I want to get a list of all the bookings for a room resource. By room resource, I mean the rooms button in outlook when creating a meeting invite.
The code I have so far returns items from my calendar but I need calendar from 'Conference room A'. Anyone have done this?
$host = 'mailhost';
$username = 'xxxx';
$password = 'xxxx';
$mail = 'xxxx';
$startDateEvent = "2013-01-14T09:00:00";
$endDateEvent = "2013-09-20T17:00:00";
$ews = new ExchangeWebServices($host, $username, $password);
$request = new EWSType_FindItemType();
$request->Traversal = EWSType_FolderQueryTraversalType::SHALLOW;
$request->CalendarView->StartDate = $startDateEvent;
$request->CalendarView->EndDate = $endDateEvent;
$request->CalendarView->MaxEntriesReturned = 100;
$request->CalendarView->MaxEntriesReturnedSpecified = true;
$request->ItemShape->BaseShape = EWSType_DefaultShapeNamesType::ALL_PROPERTIES;
$request->ParentFolderIds->DistinguishedFolderId->Id = EWSType_DistinguishedFolderIdNameType::CALENDAR;
$request->ParentFolderIds->DistinguishedFolderId->Mailbox->EmailAddress = $mail;
$response = $ews->FindItem($request);
echo '<pre>'.print_r($response, true).'</pre>';

I'm even later to the game. But The way I solved this was to create an exchange account after the name of the room, for instance boardroom#.
Then I got people to copy in boardroom# whenever they sent out a meeting request. My scripts simply interrogate boardroom#'s calendar. Everyone at the organisation has a copy of boardroom's calendar in read-only mode that they can look at to see all the meetings that week.
My software was for a display sign outside the room that showed whether the room was in use or not based upon this calendar.

Late to the game but maybe this will help someone....
Basically, php-ews never added the GetRooms operation. You could modify your app to perform the room lookup via ldap (assuming your rooms exist in AD) and then use the email address of each room and query it's calendar using impersonation.
See my answer here...
https://stackoverflow.com/a/23815914/2979715

Related

Update ticket Field in zoho desk

I'm a beginner at using Custom Function on the Zoho desk. I'm trying to update a field in the ticket template.
I have 2 fields in the ticket template [KM, COST]. The cost should equal 2*KM. For example, if KM = 100, then Cost = 200.
I created a workflow that works if the KM is updated and attached the following custom function code, but the field doesn't update.
orgId = "718524341";
response = zoho.desk.getRecordById(orgId,"tickets",TicketID,"zohodesk");
cid = response.get('cf_km');
km_cost = cid * 2;
zoho.desk.update(orgId,"tickets",TicketID,{"cf":{"cf_cost":km_cost}},"zohodesk");
The correct API Name for the tickets module in zoho desk is Tickets.
If you still can't get it to work, then try executing the function independent of the workflow with fixed parameters. Make sure to do info response and post the output here.

Cannot retrieve any room list from Exchg 2013 with c#

My exchange services works. I can see all rooms by Outlook and Can see all rooms through Powershell.
But with this snippet I cannot retrieve any room
ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2013_SP1);
service.UseDefaultCredentials = true;
service.Url = new Uri("https://my server/ews/exchange.asmx");
service.AutodiscoverUrl("username#myserver.com", RedirectionCallback);
EmailAddressCollection myRoomLists = service.GetRoomLists();
// Display the room lists.
foreach (EmailAddress address in myRoomLists)
{
Console.WriteLine("Email Address: {0} Mailbox Type: {1}", address.Address, address.MailboxType);
}
The list is empty!
It sounds like your Exchange administrator has not configured any room lists. EWS depends on the presence of room lists in the GAL to work. See https://technet.microsoft.com/en-us/library/jj215781(v=exchg.150).aspx for details.
See here for more info. You need to iterate through the room lists within the collection you got from GetRoomLists(), and then iterate through the conference rooms in each room list using service.GetRooms(myRoomList).

Is there an easy to use form to email with attachment for joomla?

I'm trying to build a custom form for a joomla website that allows users to complete some fields and attach a document that will be sent to an email address I can specify.
Does anyone know of any good components or plugins for accomplishing this ?
$from: This is the the email address that the email will look like it is coming from.
$fromname: This is the name of the person or organization this email is coming from.
$recipient: This is the email address (or array of email addresses) that the email will be going to.
$subject: This is the Subject of the email.
$body: The is the message body of the email.
$mode: Set this to 1 for HTML email, set it to 0 for text email. This field is optional.
$cc: This is the email address (or array of email addresses) that the email will be Carbon Copied to. This field is optional.
$bcc: This is the email address (or array of email addresses) that the email will be Blind Carbon Copied to. This field is optional.
$attachment: This is the full path and filename (or array of full paths and filenames) of the files that you wish to attach to the email. This field is optional.
$replyto: This is the the email address that the email will go to if the recipient clicks reply. This field is optional.
$replytoname: This is the name of the person or organization this email will go to if the recipient clicks reply. This field is optional.
Now that you know how that works, let's look at an example!
$from = 'admin#somewhere.com';
$fromname = 'BIGSHOT Blog';
$recipient[] = 'john#somewhere.com';
$recipient[] = 'jane#somewhere.com';
$subject = 'Want to learn about BIGSHOT Blog';
$body = '<p>Check us out!</p><p>http://www.somewhere.com</p>';
$mode = 1;
$cc = 'bob#somewhereelse.com';
$bcc[] = 'simon#somewhereelse.com';
$bcc[] = 'nick#somewhereelse.com';
$attachment[] = '/home/my_site/public_html/images/stories/food/coffee.jpg';
$attachment[] = '/home/my_site/public_html/images/stories/food/milk.jpg';
$replyto = 'no_reply#somewhere.com';
$replytoname = 'NO REPLY - BIGSHOT Blog';
JUtility::sendMail($from, $fromname, $recipient, $subject, $body, $mode, $cc, $bcc, $attachment, $replyto, $replytoname);
You can use JUtility::sendMail to send an email in Joomla with attachment.For more information how to use go to this link.
JUtility/sendMail
A little more digging on the joomla extensions directory and I think I found what I need: http://extensions.joomla.org/extensions/contacts-and-feedback/contact-forms/11494

EWS-managed: Fetch required and optional attendees of appointments

As far as I am now, I know how to fetch appointments from exchange server, BUT as soon as I want to see the required and optional attendees, these fields are empty ... I checked the appointment trice and there is an attendee, except me. Do I have to config Outlook differently or do I miss something?
List<Appointment> listOfAppointments = new List<Appointment>();
CalendarFolder cfolder = CalendarFolder.Bind(MyService, WellKnownFolderName.Calendar);
CalendarView cview = new CalendarView(from.ToUniversalTime(), to.ToUniversalTime());
cview.PropertySet = new PropertySet(ItemSchema.Subject);
cview.PropertySet.Add(AppointmentSchema.Start);
cview.PropertySet.Add(AppointmentSchema.End);
cview.PropertySet.Add(AppointmentSchema.Location);
cview.PropertySet.Add(AppointmentSchema.ICalUid);
cview.PropertySet.Add(AppointmentSchema.Organizer);
cview.PropertySet.Add(AppointmentSchema.IsAllDayEvent);
cview.PropertySet.Add(AppointmentSchema.DateTimeCreated);
FindItemsResults<Appointment> result = cfolder.FindAppointments(cview);
thats how I fetch the appointments, as I figured from exceptions and trail and error, I don't need to ask exchange for attendees... but maybe I am missing something.
The FindAppointments operation do not return the attendees of meetings. Instead, specify a propertyset of PropertySet.IdOnly to get only the ids of the items. Then, use the ExchangeService.LoadPropertiesForItems to perform a batch load of the properties you need.

How do I retrieve just recurring event masters using Exchange Web services?

I'm using a CalendarItemType view to retrieve calendar items. The only items I care about are those that I've created and I know that they are all weekly recurring items. I'm able to get each individual occurrence and, from any one of them the recurring master item, but I'd like to narrow the scope of my search to just those items that would match my pattern.
I've trying using the Restriction property on the FindItemType to specify a NotEqualTo restriction with a null constant for calenderRecurrenceId. This caused my request to time out. So far I've been unable to load the recurrences with the FindItemType at all and need to use a subsequent GetItemType call when I find an event that is an occurence in a recurring series.
Here's the code that I'm starting with. The code needs to work with both Exchange 2007 and Exchange 2010.
var findItemRequest = new FindItemType();
findItemRequest.ParentFolderIds = new DistinguishedFolderIdType[]
{
new DistinguishedFolderIdType()
};
((DistinguishedFolderIdType)findItemequest.ParentFolderIds[0]).Id = DistinguishedFolderIdNameType.calendar;
findItemRequest.Traversal = ItemQueryTraversalType.Shallow;
var itemShapeDefinition = new ItemResponseShapeType(
{
BaseShape = DefaultShapeNamesType.AllProperties;
}
findItemRequest.Item = calenderView;
findItemRequest.ItemShape = itemShapeDefinition;
var findItemResponse = this.esb.FindItem( findItemRequest );
Also, if you know of any good source of examples (beyond the ones in MSDN), I'd welcome them. I'm picking up someone else's code in an emergency and trying to learn Exchange Web Services on the fly.
Maybe I'm misunderstanding you, in which case I apologize.
You do NOT use the CalendarView - you use the normal IndexedPageItemView if all you want is Master Recurring Calendar items.
You use the CalendarView to expand the recurrences to individual items. However the compromise with CalendarView is NO restrictions are permitted besides Start and End Date. None.
You can search for a RecurrenceMaster by using the recurrence PidLid with an ExtendedPropertyDefinition. This works because, according to their documentation, "this property must not exist on single instance calendar items."
https://msdn.microsoft.com/en-us/library/cc842017.aspx
// https://msdn.microsoft.com/en-us/library/cc842017.aspx
ExtendedPropertyDefinition apptType = new ExtendedPropertyDefinition(
DefaultExtendedPropertySet.Appointment,
0x00008216, //PidLidAppointmentRecur
MapiPropertyType.Binary);
var restriction = new SearchFilter.Exists(apptType);
var iView = new ItemView(10);
var found = folder.FindItems(restriction, iView);
I just confirmed this works, today, when revisiting some old code that works with Office365 EWS in the cloud.
Found only property you need is RecurrenceStart property. Because EWS has limitations it is not possible to use all properties in restriction. This one working as expected.
Reference: Find master recurring appointments
You can create custom searchfilters. If you search from specific startdate OR isRecurring property you have most easy way...(SearchItems returns recurring masters)
List<SearchFilter> searchFilterCollection = new List<SearchFilter>();
SearchFilter.IsGreaterThanOrEqualTo startDatumFilter = new SearchFilter.IsGreaterThanOrEqualTo(AppointmentSchema.Start, new DateTime(2012, 9, 16));
SearchFilter.IsEqualTo masterRecurringFilter = new SearchFilter.IsEqualTo(AppointmentSchema.IsRecurring, true);
searchFilterCollection.Add(startDatumFilter);
searchFilterCollection.Add(masterRecurringFilter);
SearchFilter finalFilter = new SearchFilter.SearchFilterCollection(LogicalOperator.Or, searchFilterCollection);
ItemView itemView = new ItemView(100000);
itemView.PropertySet = new PropertySet(BasePropertySet.FirstClassProperties, AppointmentSchema.AppointmentType);
FindItemsResults<Item> items = _service.FindItems(WellKnownFolderName.Calendar, finalFilter, itemView);

Resources