0
votes

I have to invite multiple members to the google calendar while creating the event and later on when event is created then he can alter the invited member from google calendar .

Here is the code to insert the multiple invitee : but can't able to insert the attendee. but i am able to insert the remaining data.

Intent intent = new Intent(Intent.ACTION_EDIT);
                                    intent.setType("vnd.android.cursor.item/event");
                                    ArrayList<String> al = new ArrayList<String>();
                                    al.add("[email protected]");
                                    al.add("[email protected]");
                                    intent.putStringArrayListExtra(CalendarContract.Attendees.ATTENDEE_EMAIL,al);
intent.putExtra(CalendarContract.Events.EVENT_LOCATION, locationName);

Update google Calendar : Here i am able to update the value of the endTime but attendee is not been updated .

public void updateEvent(long eventID,long endTime,String calendarEventID){
        Intent intent = new Intent(Intent.ACTION_VIEW);
        intent.setData(Uri.parse("content://com.android.calendar/events/" + calendarEventID));
        ContentResolver cr = getActivity().getContentResolver();
        Uri eventUri = ContentUris.withAppendedId(CalendarContract.Events.CONTENT_URI, eventID);
        ContentValues event = new ContentValues();
        event.put(CalendarContract.Events.DTEND, endTime);
        event.put(CalendarContract.Attendees.ATTENDEE_EMAIL, "[email protected]");
        cr.update(eventUri, event, null, null);
        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        getActivity().startActivity(intent);
    }
1
you can use for loopDarshan Kachhadiya

1 Answers

0
votes

According to the Android docs in Adding Attendees, you ought to use put instead of like:

Here is an example that adds a single attendee to an event. Note that the EVENT_ID is required:

long eventID = 202;
...
ContentResolver cr = getContentResolver();
ContentValues values = new ContentValues();
values.put(Attendees.ATTENDEE_NAME, "Trevor");
values.put(Attendees.ATTENDEE_EMAIL, "[email protected]");
values.put(Attendees.ATTENDEE_RELATIONSHIP, Attendees.RELATIONSHIP_ATTENDEE);
values.put(Attendees.ATTENDEE_TYPE, Attendees.TYPE_OPTIONAL);
values.put(Attendees.ATTENDEE_STATUS, Attendees.ATTENDEE_STATUS_INVITED);
values.put(Attendees.EVENT_ID, eventID);
    Uri uri = cr.insert(Attendees.CONTENT_URI, values

);