2011-03-16 62 views
2

我有以下代碼來創建一個Gmail聯繫人的新日曆:有沒有更改Google日曆的訪問級別的方法?

// Create a CalenderService and authenticate 
CalendarService myService = new CalendarService("exampleCo-exampleApp-1"); 
myService.setUserCredentials("[email protected]", "password"); 

CalendarEntry calendar = new CalendarEntry 
{ 
    Title = { Text = "Example title" }, 
    Summary = { Text = "Example summary" }, 
    TimeZone = "Europe/London", 
    Hidden = false, 
    Color = "#2952A3", 
    Location = new Where("", "", "Location"), 
}; 

Uri postUri = new Uri("https://www.google.com/calendar/feeds/default/owncalendars/full"); 
CalendarEntry createdCalendar = (CalendarEntry)myService.Insert(postUri, calendar); 

有沒有我可以用它來共享日曆的一些其他方法或屬性,在構造函數中,或者它被創建之後?我瀏覽過所有內容,但沒有任何內容跳出來,一直在搜索並瀏覽這個網站,但沒有運氣。

我見過如何設置每個事件的訪問級別的例子,可以單獨嘗試,但不能通過點擊Google的日曆設置來實現整個日曆。

感謝

回答

1

發現任何人soution誰遇到這樣的:

string postUristring = string.Empty; 

// note this could change in future! 
string feedString = createdCalendar.Id.AbsoluteUri.LastIndexOf("/") + 1; 
postUristring = feedString.Substring(0, feedString.Length - 28); 

AclEntry entry = new AclEntry(); 

entry.Scope = new AclScope(); 
entry.Scope.Type = AclScope.SCOPE_DEFAULT; 

entry.Role = new AclRole(); 
entry.Role = AclRole.ACL_CALENDAR_READ; 

Uri aclUri = new Uri("http://www.google.com/calendar/feeds/" 
      + postUristring + "@group.calendar.google.com" + "/acl/full"); 

AclEntry insertedEntry = myService.Insert(aclUri, entry); 
+0

這是值得注意的,因爲你寫了這個代碼的子指數已經改變。 (或者至少現在對我來說已經不同了)。代碼中的63的索引不再準確。爲了彌補這一點,我目前將其設置爲「LastIndexOf(」/「)+ 1」,但我想Google保留隨時更改網址的權利。 – David 2012-05-25 18:42:39

相關問題