我创建提供程序托管的应用程序,该应用程序应该在SharePoint中创建一个calendarlist。我希望它稍后成为一个组日历,但首先我只需要执行第1步:创建日历。提供程序托管的Sharepoint应用程序,创建SharePoint日历
我无法找到任何提供商托管的指南,了解如何以编程方式创建SharePoint日历。我无法找到日历ListTemplateStyle
所以我想事件的模板,我不知道它goint工作,因为有显示出来,当我尝试运行下面这段代码的错误:
Uri hostWeb = new Uri(Request.QueryString["SPHostUrl"]);
using (var clientContext = TokenHelper.GetS2SClientContextWithWindowsIdentity(hostWeb, Request.LogonUserIdentity))
{
Web web = clientContext.Web;
ListCreationInformation listCreator = new ListCreationInformation();
listCreator.Title = "CompanyCalendar";
listCreator.Description = "Workcalendar";
listCreator.TemplateType = (int)ListTemplateType.Events; //106 = events
//clientContext.Load(web);
web.Lists.Add(listCreator);
clientContext.ExecuteQuery();
}
System.Net.WebException: The remote server returned an error: (401) Unauthorized.
Line 27: //clientContext.Load(web);
Line 28: web.Lists.Add(listCreator);
Line 29: clientContext.ExecuteQuery();
Line 30:
Line 31: }
这似乎是未经授权在这里创建一个列表出于某种原因。我有Web权限设置为完全控制,我的证书看起来像这样:
<appSettings>
<add key="ClientId" value="ebcb24ca-afbb-4822-8887-f91504f3d25f" />
<add key="ClientSigningCertificatePath" value="C:\Certs\HighTrustSampleCert.pfx" />
<add key="ClientSigningCertificatePassword" value="1234" />
<add key="IssuerId" value="11111111-1111-1111-1111-111111111111" />
</appSettings>
任何idéas?
我的第二个问题是:我需要学习如何使日历成为组日历?任何提示?
感谢
我想我不能以编程方式创建日历,所以我想我必须首先创建一个通用的列表,然后以某种方式创建一个CalendarView但在这里我的问题是,我不明白。允许在我的开发者网站上创建一个简单的列表。我不知道该怎么办 :( – Hannes