Hi Brett, Try this: Build the feed URL for the calendar of interest and use the CalendarService.getFeed() to retrieve it. Then use the BaseFeed.getCanPost() API [1] to check to see if it's possible to post new entries to it with the same authentication context as was used to retrieve the feed.
Cheers! -- Kyle [1] - http://code.google.com/apis/gdata/javadoc/com/google/gdata/data/BaseFeed.html#getCanPost() On 4/1/07, brettmoreton2111 <[EMAIL PROTECTED]> wrote: > > > thanks ryan, i was using the wrong URL... > > Is there a way to find the access level of another persons calendar. > For example, i have created a web application which allows you to add > events into other peoples calendars. The user decides which calendar > to add into by choosing an option from a drop down menu. The drop down > menu is populated with all the people who this user has access to. The > application finds the email address associated with the chosen > calendar, and this is how events are added into it: > > URL feedUrl = > new URL("http://www.google.com/calendar/ > feeds/"+selectedCalendarEmailAddress+"/private/full"); > > //Code to construct an event and insert it etc... > > So imagine Luke Jones gives me read-only permission to his calendar. > How can I check my access level to his calendar before I try adding an > event into it? > > thanks > > Brett > > On Apr 1, 11:25 pm, "Ryan Boyd (Google)" <[EMAIL PROTECTED]> wrote: > > Hi Brett, > > > > Well - that was just an example. If you already used the entry > > variable name, you could use something else. In this case, 'entry' > > should represent a CalendarEntry from the calendar meta-feed (notice > > the example method retrieves /calendar/feeds/default rather than > > something like /calendar/feeds/default/private/full). > > > > Have you taken a look at the full method posted? This retrieves the > > meta feed and looks through each calendar and prints out the title and > > access level. > > > > Cheers, > > > > -Ryan > > > > On Apr 1, 3:02 pm, "brettmoreton2111" <[EMAIL PROTECTED]> > > wrote: > > > > > Hi Ryan thanks for your reply, however i'm still having some problems: > > > > > entry.getTitle().getPlainText()); is returning the title of the last > > > event inserted > > > entry.getAccessLevel().getValue()); is causing a NullPointerException > > > > > does the entry.getAccessLevel refer to the calendar or an individual > > > entry within the calendar? > > > > > i'm creating a web application using AuthSub login, if that makes any > > > difference? > > > > > thanks > > > > > On Apr 1, 7:59 pm, "Ryan Boyd (Google)" <[EMAIL PROTECTED]> wrote: > > > > > > BTW-- to access this information in the Java Client lib, you can do: > > > > entry.getAccessLevel().getValue()) > > > > > > Here's a modified version of the sample/calendar/ > > > > CalendarClient::printUserCalendars method that outputs the > accesslevel > > > > as well. > > > > > > /** > > > > * Prints a list of all the user's calendars. > > > > * > > > > * @param service An authenticated CalendarService object. > > > > * @throws Exception If an error occurs during feed retrieval. > > > > */ > > > > private static void printUserCalendars(CalendarService service) > > > > throws Exception { > > > > URL feedUrl = new URL("http://www.google.com/calendar/feeds/ > > > > default"); > > > > > > new > > > > CalendarFeed().declareExtensions(service.getExtensionProfile()); > > > > > > // Send the request and receive the response: > > > > CalendarFeed resultFeed = service.getFeed(feedUrl, > > > > CalendarFeed.class); > > > > > > System.out.println("Your calendars:"); > > > > System.out.println(); > > > > for (int i = 0; i < resultFeed.getEntries().size(); i++) { > > > > CalendarEntry entry = resultFeed.getEntries().get(i); > > > > System.out.println("\t" + entry.getTitle().getPlainText()); > > > > System.out.println("\t" + entry.getAccessLevel().getValue()); > > > > } > > > > System.out.println(); > > > > } > > > > > > Cheers, > > > > > > -Ryan > > > > > > On Apr 1, 11:50 am, "Ryan Boyd (Google)" <[EMAIL PROTECTED]> > wrote: > > > > > > > Yes, there is a <gCal:accesslevel...> element in the calendar > meta- > > > > > feed (when authenticated): > http://www.google.com/calendar/feeds/default > > > > > > > The documentation on gCal::accesslevel is at: > http://code.google.com/apis/calendar/reference.html#gcal_reference > > > > > > > Note, there is also an additional access level which is called > > > > > 'root'. This is held by a domain admin of Google Apps for all > > > > > calendars on their domain. It has the same privileges as > 'manager'. > > > > > Also, note, 'contributor' should be 'editor'. These bugs have > been > > > > > filed against our documentation. > > > > > > > Cheers, > > > > > > > -Ryan > > > > > > > On Apr 1, 9:23 am, "[EMAIL PROTECTED]" < > [EMAIL PROTECTED]> > > > > > wrote: > > > > > > > > is there an API call which will allow me to check the permission > I > > > > > > have on a certain calendar? > > > > > > > > I want to know if a calendar is read-only before i try and > insert an > > > > > > event into it, via the API. > > > > > > > > Thanks > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Calendar Data API" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/google-calendar-help-dataapi?hl=en -~----------~----~----~----~------~----~------~--~---
