Graph API calendarid is not unique and changing - microsoft-graph-api

I have noticed that the calendar id is not a unique value and it changes for reasons unknown.
I have stored some calendar id values in a database. At a later point when tried to insert events using those values, the id stored in database no longer matches the Calendar id in Microsoft Graph. Upon investigation the calendar id has been changed in the last few characters.
Can someone explain this anomaly please? any workarounds
Regards

For an event, the id property is a composite value based on a number of other properties. If something changes (such as the path to the item), the id value will change. So while it is unique to a mailbox, it is not suitable for a permanent reference to the event.
With an event, you should use the iCalUid property. This is a unique value that is permanently persisted across all calendars. So even if the event is a meeting with multiple attendees, each attendee will persist the same iCalUid even if an attendee isn't part of your organization, or even on Exchange).
For the Calendar itself, I wouldn't expect the id to change unexpectedly (i.e. the user didn't delete and recreate or edit the calendar itself in some way).

Related

Core data FIFO? (first in first out)

Im sitting with this issue bugging me. I have core data working fine, but when it fetches, in my case, the users, they come back in different orders. Normally would use the standard unique identifier, but core data doesn't have this. So....
Do I manually create an ID entity_property and assign it incrementally, or is the "object id" being made in incremental order; incremented maybe by 1, or just random IDs? hence making me able to use object id.
My goal is to get my fetched array in the same order the users was inserted.
Thanks
You'll need your own technique for generating the unique ID. Run that code in your NSManagedObject subclass's -awakeFromInsert, which is called once, when the object is inserted into the datastore. You can add a timestamp, or the value of an incrementing counter.
There's no built-in support for an autoincrement ID. You'll need a class variable, and increment that yourself in -awakeFromInsert. You'll also have to persist that value across launches, either as its own Entity or within the persistent store's metadata.
You might benefit from using an ordered relationship, if those users have a one-to-many relationship with some other entity.
The NSManagedObjectID is unique within the store, but will change when the NSManagedObjectContext is saved (and the NSMOID goes from temporary to permanent). No promises are made about its sequence or pattern of construction. And it can change during a managed object model migration. So don't depend on it for anything you need to control.
core data does not return ORDERED data. so, if your data is "string" or "date" type then you can simply sort your data by ascending/descending after fetching from code-data.

Does CKRecordZoneID need to be unique per user?

Is a CloudKit record zone created per user basis, or does it apply to everyone?
A CKRecordZoneID object uniquely identifies a record zone in a database.
This seems to imply that it's affecting for everyone.
A record zone ID distinguishes one zone from another by a name string and the ID of the user that created the zone.
However, the fact that the ID appends the owner name, made it sound like it's per user basis?
The reason why I'm asking is I'd like to know if I can create a single RecordZoneID for the app or does it need to be stored per user (in NSUserDefaults)
The short answer is that zone names only need to be unique among the other zones in a user's private database.
There's a subtle but important difference between a CKRecordZoneID and a zone name.
A CKRecordZoneID must be unique across your entire container, but a CKRecordZoneID is more than just the zone name.
If you look at CKRecordZoneID you'll see that it has both a zoneName property and an ownerName property. The ownerName is the record ID of the current user (or CKOwnerDefaultName, which gets replaced by the real user ID before the value is sent to the server).
The combination of zoneName and ownerName must be unique across the container, but since every user has their own unique user ID (which is used for ownerName) you can create a zone with the same zoneName for every user and not have any conflicts.

How to fetch the last entry of each entity in core data iOS

I am making a chat application in iOS. I saved the last conversation of every friend. My core data entity has 3 fields - jID, message and timestamp. I don't set indexing on any field.I just want to fetch the last message of each jID. So,please help me and also tell me whether to set indexing on any field so that fetching process would be appropriate.
You could also add a one-to-one relationship between your entity and the last conversation (you will have to maintain it yourself, if you reveal your model I might be able to be a bit more specific).
A property that is used to filter data, and is used to access elements by, should probably be indexed.
This mean that you probably would want your jID and timestamp indexed.
If you want to fetch the last object, you'll need to have them ordered. Timestamp would be fine for this. And if you want to fetch the last object, reverse the ordering and just fetch the first instead.
If you want to use jID, the ids will have to be in some kind of order.

What is the difference between id, ticket_id and barcode on attendee from Eventbrite API?

I am looking at documentation http://developer.eventbrite.com/doc/attendees/.
First of, it seems like the actual 'id' field in the json returned represents the attendee record id, as there is the actual 'event_id' field. Seems like a documentation issue.
I need a field I can use as an identifier to sync Eventbrite attendees with my records.
The 'id' field is the obvious candidate. Can I rely on 'id' to be unique across the whole API or it may be reused from event to event?
What is the relationship between 'id' and 'ticket_id'? Can multiple attendees with diff ids have the same 'ticket_id'?
What is the relationship between 'id' and 'barcode'? One attendee can have multiple barcodes?
Would appreciate a clarification.
Good question, I'll update the docs with some additional info.
The short answer:
The ticket_id is the ID of a specific ticket type (General Admission, VIP, etc). A user may purchase multiple tickets of multiple types in a given order. An 'attendee' record is created for each ticket that is purchased.
The attendee_id is meant to identify the mapping between a user and a ticket type within the event's context. A user's attendee_id will be different for each ticket.
There should be one barcode_id per attendee_id. Barcode values can be used to check an attendee in or out of an event.
Hope that helps!
#RyanJ

Core Data, "sorting by transient property" workaround

Let's say I have a Core Data entity called Event, which represents recurrent (yearly) events. Each Event has a "date" property.
I need to present this events to the user sorted by "next occurrence of date". This property, of course, depends on the current date and as such should be marked as transient: there's no point in storing it in the database.
But, as you know, you can't query sorting by a transient property in Core Data.
Is there a smart way to keep this property transient and still have Core Data sort for me? I don't want to fetch and then sort myself, but I would also like to avoid storing this transient info in the database.
If you store the date in a separate entity, then you can fetch just the dates and sort them yourself however you like. You'd have a relationship from Event to EventDate, and a corresponding inverse relationship that lets you find the Event from a given EventDate.
Suggestion: Specify a sort descriptor in your fetch request so that you get the dates sorted from the beginning of the year. Then all you have to do is locate the current date in the returned array, and move everything before that point to the end of the array.
Make the EventDate->Event relationship to-many, since it might happen that more than one Event falls on the same date. Setting your model up like this gives you the nice property that you can easily answer the question "What events happen on date X?"

Resources