I have been struggling with a small piece of code that is in the following blog:
http://blogs.msdn.com/b/bethmassi/archive/2010/06/28/integrate-outlook-appointments-with-sharepoint-2010-calendar-lists-using-data-services.aspx
The problem is that when I run the code I get the following exception:
System.Data.Services.Client.DataServiceQueryException was unhandled by user code
HResult=-2146233079
Message=An error occurred while processing this request.
Source=Microsoft.Data.Services.Client
StackTrace:
at System.Data.Services.Client.DataServiceRequest.Execute[TElement](DataServiceContext context, QueryComponents queryComponents)
at System.Data.Services.Client.DataServiceQuery`1.Execute()
at System.Data.Services.Client.DataServiceQuery`1.GetEnumerator()
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
at UpdateSharePointCalendar.ThisAddIn.GetSPCalendarData(DateTime theDate) in C:\Users\ian\documents\visual studio 2012\Projects\UpdateSharePointCalendar\UpdateSharePointCalendar\ThisAddIn.vb:line 35
at UpdateSharePointCalendar.FormRegion1.PopulateDataGrid() in C:\Users\ian\documents\visual studio 2012\Projects\UpdateSharePointCalendar\UpdateSharePointCalendar\FormRegion1.vb:line 64
at UpdateSharePointCalendar.FormRegion1.AddToSharePoint_FormRegionShowing(Object sender, EventArgs e) in C:\Users\ian\documents\visual studio 2012\Projects\UpdateSharePointCalendar\UpdateSharePointCalendar\FormRegion1.vb:line 60
at System.EventHandler.Invoke(Object sender, EventArgs e)
at Microsoft.Office.Tools.Outlook.FormRegionControlImpl.Microsoft.Office.Tools.Outlook.IFormRegion.OnStartup()
at Microsoft.Office.Tools.Outlook.FormRegionBase.OnStartup()
at Microsoft.Office.Tools.Outlook.FormRegionManagerImpl.Microsoft.Office.Interop.Outlook._FormRegionStartup.BeforeFormRegionShow(FormRegion outlookFormRegion)
InnerException: System.Data.Services.Client.DataServiceClientException
HResult=-2146233079
Message=403 FORBIDDEN
Source=Microsoft.Data.Services.Client
StatusCode=403
StackTrace:
at System.Data.Services.Client.QueryResult.ExecuteQuery(DataServiceContext context)
at System.Data.Services.Client.DataServiceRequest.Execute[TElement](DataServiceContext context, QueryComponents queryComponents)
InnerException:
This happens on the follwing section of code:
Can anyone suggest a solution to this, so that the grid can be filled and the appointment be created as required.
Best regards and thanks in advance
Ian
http://blogs.msdn.com/b/bethmassi/archive/2010/06/28/integrate-outlook-appointments-with-sharepoint-2010-calendar-lists-using-data-services.aspx
The problem is that when I run the code I get the following exception:
System.Data.Services.Client.DataServiceQueryException was unhandled by user code
HResult=-2146233079
Message=An error occurred while processing this request.
Source=Microsoft.Data.Services.Client
StackTrace:
at System.Data.Services.Client.DataServiceRequest.Execute[TElement](DataServiceContext context, QueryComponents queryComponents)
at System.Data.Services.Client.DataServiceQuery`1.Execute()
at System.Data.Services.Client.DataServiceQuery`1.GetEnumerator()
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
at UpdateSharePointCalendar.ThisAddIn.GetSPCalendarData(DateTime theDate) in C:\Users\ian\documents\visual studio 2012\Projects\UpdateSharePointCalendar\UpdateSharePointCalendar\ThisAddIn.vb:line 35
at UpdateSharePointCalendar.FormRegion1.PopulateDataGrid() in C:\Users\ian\documents\visual studio 2012\Projects\UpdateSharePointCalendar\UpdateSharePointCalendar\FormRegion1.vb:line 64
at UpdateSharePointCalendar.FormRegion1.AddToSharePoint_FormRegionShowing(Object sender, EventArgs e) in C:\Users\ian\documents\visual studio 2012\Projects\UpdateSharePointCalendar\UpdateSharePointCalendar\FormRegion1.vb:line 60
at System.EventHandler.Invoke(Object sender, EventArgs e)
at Microsoft.Office.Tools.Outlook.FormRegionControlImpl.Microsoft.Office.Tools.Outlook.IFormRegion.OnStartup()
at Microsoft.Office.Tools.Outlook.FormRegionBase.OnStartup()
at Microsoft.Office.Tools.Outlook.FormRegionManagerImpl.Microsoft.Office.Interop.Outlook._FormRegionStartup.BeforeFormRegionShow(FormRegion outlookFormRegion)
InnerException: System.Data.Services.Client.DataServiceClientException
HResult=-2146233079
Message=403 FORBIDDEN
Source=Microsoft.Data.Services.Client
StatusCode=403
StackTrace:
at System.Data.Services.Client.QueryResult.ExecuteQuery(DataServiceContext context)
at System.Data.Services.Client.DataServiceRequest.Execute[TElement](DataServiceContext context, QueryComponents queryComponents)
InnerException:
This happens on the follwing section of code:
Public Function GetSPCalendarData(ByVal theDate As Date) As List(Of CalendarItem) Dim results = From ci In SPContext.Calendar Where CDate(ci.StartTime) = theDate Return results.ToList() End Function
Can anyone suggest a solution to this, so that the grid can be filled and the appointment be created as required.
Best regards and thanks in advance
Ian