I'd like to use Google Calendar for adding party events, so I added a new calendar, "events". Is there a function for deleting all events in that calendar?
Or is it only possible by deleting the whole calender and re-creating it?
I'm having offline data which updates daily, so I thought the best method would be flushing the whole Google Calendar calendar and simply uploading all events.
This is helpful: Google Calendar .NET API documentation.
// Create a CalenderService and authenticate
CalendarService myService = new CalendarService("exampleCo-exampleApp-1");
myService.setUserCredentials("jo#gmail.com", "mypassword");
// Create the query object:
EventQuery query = new EventQuery();
query.Uri = new Uri("https://www.google.com/calendar/feeds/[calendar]/private/full");
where [calendar] = "jo#gmail.com" for default calendar or in your instance, the ID of your 'events' calendar (found in calendar in Gmail), that is, https://www.google.com/calendar/[calendarID]/private/full"
// Tell the service to query:
EventFeed calFeed = myService .Query(query);
// This should delete all items in your calendar
foreach(var item in calFeed.Entries) {
entry.Delete();
}
Related
I'm working with Xamarin in Visual Studio.
I'm utilizing Parse (via SashiDo.com) and I'm trying to create a relation between my Users and the ParseObjects in a table called called Dispatch, like so:
//Make the new Dispatch object
var parseDispatch = new Parse.ParseObject("Dispatch");
//Save it
await parseDispatch.SaveAsync();
//...Setting various properties on the Dispatch object...
//Get a list of users (via another method)
IEnumerable<ParseUser> usersToLink = UsersToLinkToDispatch(); //And have verified elsewhere that this indeed returns a collection of ParseUsers
//Go through the users collection
usersToLink.ToList().ForEach( async (user) => {
//Get or create the dispatches-tracking relation for this user
var dispatchObjectRelation = parseDispatch.GetRelation<ParseObject>("DispatchesTracked");
//Add the current user to that tracker relation
dispatchObjectRelation.Add(user);
//save the dispatch to update the relation
await parseDispatch.SaveAsync();
});
So, when I go to inspect my tables in SashiDo, if I look at the Dispatches table, I see a proper-looking relational link, and if I click on that link, I see the list of linked Users. So far so good, right?
But if I look at the Users table, while there also seems to be a proper-looking relational link, when I click on it I do not see a list of linked Dispatches.
Is this expected behavior, or is this apparent one-way-ness of the relational link an error?
I created new Google calendar with API v3 in c# with Service account. I also set ACL rule:
var permission = new AclRule()
{
Scope = new AclRule.ScopeData() { Type = "domain", Value = "mydomain.com" },
Role = "reader",
};
Problem is how can users of domain "nicely" add this calendar to "Other calendars" in calendar.google.com site?
They can add it if they enter calendar id, which is not user friendly, since id is some random string:
4b123456789glvpvasaaaaaaaar4#group.calendar.google.com
. I though I could search by calendar summary. But this is not the case. Only entering complete calendarId adds it to calendar list.
I want to get all users from Exchange server, I don't want to get user's contacts. In fact, I want to get all AD users as Active Directory which we can't connect to.
mExchangeService.ImpersonatedUserId = new ImpersonatedUserId
{
Id = "jack#aa.com",
IdType = ConnectingIdType.SmtpAddress
};
var contacts = _mExchangeService.FindItems(new FolderId(WellKnownFolderName.Contacts),new ItemView(1000));
I can above code to get user's contact, but that's not I want, I want use a service account to get all Exchange web service users.
You can sort of use EWS for retrieving your directory users using ExhangeService.ResolveName. The problem is that EWS will return no more than 100 users and there is no way to change it or to do any paging. So if you are in a larger company you can't really do it using EWS.
The code:
var nameResolutionCollection = service.ResolveName("SMTP:",
ResolveNameSearchLocation.DirectoryOnly, true);
foreach (var c in nameResolutionCollection)
{
Console.WriteLine(c.Mailbox.Address);
}
Console.WriteLine(nameResolutionCollection.Count()); // Maximum 100 users.
I've created a OData V4 Service described in the articles on the ASP.NET Homepage.
I basically have a table Events where I assign Guests to. I need additional information to this many to many relationship, so I have created a EventGuest table.
Inserting Events and inserting Guests via OData just works fine. It just doesn't want to work, as soon as I want to insert related entities.
This is my Controller-Code:
public async Task<IHttpActionResult> Post(EventGuest eventGuest)
{
if (!ModelState.IsValid)
{
return BadRequest(ModelState);
}
_db.EventGuest.AddOrUpdate(eventGuest);
await _db.SaveChangesAsync();
return Created(eventGuest);
}
And this is how I want to insert the relationship. For the Client Code I use the official T4 template.
var ev = container.Event.FirstOrDefault();
var guest = container.Guest.FirstOrDefault();
var evGuest = new EventGuest();
evGuest.Guid = Guid.NewGuid();
container.AddObject("EventGuest", evGuest);
container.SetLink(evGuest, "Event", ev);
container.SetLink(evGuest, "Guest", guest);
container.SaveChanges();
The request sent to the Server doesn't look too bad for me:
{"#odata.type":"#Entities.EventGuest","CreationTimestamp":"0001-01-01T00:00:00Z","Guid":"adf500e3-e3a1-4841-883e-2322ed863321","ID":0,"Event#odata.bind":"http://localhost/odata/Event(1)","Guest#odata.bind":"http://localhost/odata/Guest(1)"}
So the Server tries to use #odata.bind, but unfortunately in the POST-Method of the Controller the referenced entities "Guest" and "Event" are null.
Have you tried following the example at the MSDN Documentation? I noticed it always uses AddLink rather than SetLink, even in the SetLink documentation.
MSN Article is here: DataServiceContext.SetLink Method
I'm trying to display related users through the Google GData Contacts API.
URL feedUrl = new URL("https://www.google.com/m8/feeds/contacts/default/full");
Query q = new Query(feedUrl);
q.setMaxResults(max);
q.setUpdatedMin(q.getUpdatedMin());
ContactFeed feed = client.query(q, ContactFeed.class);
for(ContactEntry item : feed.getEntries()){
[...]
}
I know that there is a public image url for profiles on Google.
https://www.google.com/s2/photos/profile/{user_id}
https://plus.google.com/s2/photos/profile/{user_id}
https://profiles.google.com/s2/photos/profile/{user_id}
However, when I retrieve a user's contacts, there just doesn't seem to be a field available to reference that user_id.