I am trying to query Google's Calendar API to get a list with Events that matches the List with EventIds.
So i have a list of EventIds and i want to get the corresponding events from Google Calendar.
I found the parameter 'q' with the following description:
"Free text search terms to find events that match these terms in any field, except for extended properties. Optional."
It's from this page: https://developers.google.com/google-apps/calendar/v3/reference/events/list
My problem is that i have no idea what to pass into 'q' (no documentation on that page or any reference to where that can be found) and if this parameter can help me get the list back with the specific ids?
The API method you found is GET https://www.googleapis.com/calendar/v3/calendars/calendarId/events and is used to get a list of all events from a particular calendar. This is done by changing calendarId to the ID of the calendar you want to get events from. q is an optional parameter you can pass when you make this GET request that limits the events returned from the calendar to those events matching a particular search term.
Since you already have a list of eventId's, this is not the method you are looking for. You should instead use the Events.get method: GET https://www.googleapis.com/calendar/v3/calendars/calendarId/events/eventId. In this URI, you replace calendarId with the ID of the calendar that has the event and you replace eventId with the particular event id from your list of events. You can make repeated calls to this API URI while changing the eventId each time to get the Event resource for each of the events in your list.
The Events.get method above will work for you, but is not the most efficient way to retrieve your events. You can look into batch requests in the future to group all your API calls together to more efficiently retrieve the events.
Related
I developing a sale system using asp.net mvc. My search system allows users to save their search criteria and will notify them by email when a new product is posted is met their criteria. I tried the following:
The first way: Create a function to send bulk mail through gmail and I put this function in the post function. You can see the code described below to understand what I said:
public ActionResult PostProduct()
{
....
var list = Check(); // get a list of user email when their search criteria are met with the posted product
Send(list); // send email to the list
// I don't know how long does it take to complete this function?
}
However, this method requires a lot of resources from the server and takes a lot of time to respond (if the number of emails up to 1000, it would be a bad thing), but I can customize the parameters into email content (such as links, images, ...)
The second way: I used a mail service (MailChimp) and I called its API successfully, sending mail seems easy but I can not adjust the input parameters. That means I can not customize the content of my email.
I would like to ask people if there is a better and wiser way of doing things than I used to. Thank for reading
I'm developing a win forms application using AxosoftAPI.NET. I've implemented functionality to search for Items like Tasks, Defects, Incidents and Projects.
I can also check whether an Item has attachments. Now I need to know how to check if an Item (Task or Defect) has an Install or Testing Note attached to it. I searched in Axosoft's developers website but couldn't find anything helpful. How can I achieve this in C# using AxosoftAPI.NET?
Install and Testing Notes are not standard fields in Axosoft so are most likely Custom Fields that were added by your team. All custom fields should be returned when getting items, however large text fields, are only returned when getting a single item, rather then getting lists of items.
From the developer.axosoft.com page regarding the GET multiple and specifying the columns parameter :
(comma seperated string) Containins the names of the columns to return for each item. Defaults to all columns. However, please note that for performance reasons long text fields (such as 'Description') are not returned by this API call. To get the values of long text fields, use the GET /defects/{id} call to retrieve a single item.
We are doing Exchange web server synchronization with our application. To identify EWS changes we use; service.SyncFolderItems() method, like explain on MSDN. But, while doing initial sync it takes all the events in calendar, very older ones too. To avoid getting older events we need to use time period or Sync Start From time while requesting changes from SyncFolderItems() method.
1) Can SyncFolderItems() method accept user given time period when getting events from EWS ? & How ?
2) If not, Any workaround ?
There is a way to avoid older events in calendar using service.SyncFolderItems() method.
<SyncFolderItems>
<ItemShape/>
<SyncFolderId/>
<SyncState/>
<Ignore/>
<MaxChangesReturned/> <SyncScope/>
</SyncFolderItems>
That Ignore parameter will accept List of event Ids. and ignore them while syncing. To do that , First we need to retrieve older event IDs, Exchange will only accept two years old event
DateTime startDate = DateTime.Now.AddYears(-2); //start from two years earlier
DateTime endDate = DateTime.Now.AddMonths(-1); // End One Month before,
//you can use Convert.ToDateTime("01/01/2013"); what ever date you wanted.
Create Item id List;
List<ItemId> itmid = new List<ItemId>();
Create Calendar View object;
CalendarView cView = new CalendarView(startDate, endDate);
Retrieve Appointments;
// Retrieve a collection of appointments by using the calendar view.
FindItemsResults<Item> appointments = service.FindItems(WellKnownFolderName.Calendar, cView);
Or you can use this, But previous code have some optimization. (Google)
FindItemsResults<Appointment> appointments = service.FindAppointments(WellKnownFolderName.Calendar, cView);
Add retrieve event ids into list,
foreach (var item in appointments)
{
itmid.Add(item.Id);
}
Finally, in your SyncFolderItems method will looks like this;
service.SyncFolderItems(new FolderId(WellKnownFolderName.Calendar), PropertySet.IdOnly, itmid, 10, SyncFolderItemsScope.NormalItems, sSyncState);
Hope this will help any of you.
Currently, SyncFolderItems only supports synchronizing the entire mailbox. It doesn't support synchronizing starting from a specific time period. This type of request has been shared with the product planners. Hopefully we'll see this type of functionality.
In terms of workarounds, you could:
1) Sync all of the events with only the ItemId. Throw away items don't need.
2) Perform a FindItems with your intended time period, use GetItem (Bind) to get the events, and then use notifications to learn when a new item arrives, or when an item is updated. What you won't get with this is what has changed. For new items, this isn't an issue. But for updated items, you'll have to perform a GetItem (Load) and then diff the updated and old items to see what has changed.
We are currently working on creating a sync service between our product and Exchange using Exchange Web Services Managed API. Specifically we want to sync (on a time schedule) specific Appointments back and forth on a users calender. As part of the sync, we don't necessarily want to sync ALL appointments, but have built up some complex SearchFilters to return only the appointments we want. Our problem is that in order to use the SearchFilters, we need to use the ExchangeService.FindItems method, but this method only returns the Master Recurrence of recurring events. Our other option is to use ExchangeService.FindAppointment, this will do the Recurrence Expansion for us, but has the new problem that we can only limit the result appointments using a start and end date. Looking at how the ExchangeService.FindAppointment is implemented, we can see that it is implemented using the FindItems method, which leads me to believe that I should be able to tell the ExchangeService.FindItems method to do a recurrence expansion.
How can I get a list of expanded appointments from exchange using a complex SearchFilter?
Just found this on MSDN:
http://msdn.microsoft.com/en-us/library/hh148195(v=exchg.140).aspx
Considerations for searching calendar appointments
Calendar appointments are a special case for searches. Some calendar appointments, such as recurring appointments, can have exceptions and deleted occurrences. To ensure that the Exchange server expands recurring appointments when searching a calendar folder, you need to use calendar paging. When you use calendar paging, however, you can’t use any other search restrictions. This means that if, for example, you want to display all of the calendar appointments this month for a particular organizer, you can't create a search filter that is based on the organizer. Instead, you can use the CalendarView class to query for all appointments in the month and then filter the appointments on the client side based on the organizer. The following example shows how to use a calendar view to search for appointments in a calendar.
For anyone that finds guxiyou's solution with FindAppointments/CalendarView impractical, my solution below. CalendarView is especially not convenient in a situation of automatic synchronization where you'd preferably use a "last modified" filter instead of retrieving everything and filtering client-side, which is not very performant.
I used the regular FindItems way which does support filters, and while iterating the appointments checked AppointmentType, which in case of a RecurrenceMaster type would find the linked occurrences and add these to the to-be-synced list.
Below the method to subsequently get the occurrences of these appointments. Recurrent patterns with no end date are ignored as these would make your loop infinite. These recurrences would have to be handled differently to be synchronized anyway, unless you limit the synchronization window.
private IEnumerable<Appointment> GetRecurrentAppointments(Appointment masterAppointment)
{
Recurrence recurrence = masterAppointment.Recurrence;
if (recurrence == null || !recurrence.HasEnd)
yield break;
for (int i = 1; i <= recurrence.NumberOfOccurrences; i++)
{
Appointment occurrence = Appointment.BindToOccurrence(ExchangeServiceProxy, masterAppointment.Id, i);
yield return occurrence;
}
}
I have implemented Examine in an Umbraco project and have created an index of my site's content. What I now need is a list of terms stored in that index for any given field.
This list of terms will be the basis for an autocomplete search field of a UI form.
How can I retrieve this list of terms based upon a specific field, e.g. nodeName?
Please note, I do not want to search against the nodeName field. I wish to read/retrieve the terms in the index associated with the field.
You may try this:
reader.terms(new Term("nodeName", ""));
It seems this is not possible but since the Examine library is based upon the Lucene library, it is a matter of "rolling your own" and just opening and interrogating an IndexReader instance using the reader.Terms() method.