Tag: sharepoint 2010

sharepoint aspx页面的代码隐藏在哪里?

毫无疑问,我在这里遗漏了一些非常明显的东西 – 但我是分享点的新手所以请耐心等待。 我已经成功添加了一个母版页,创建了一个内容类型,并为我的自定义内容类型创建了一个aspx页面 – 但我找不到它的cs文件!? 还有另一种方法可以在sharepoint解决方案中实现代码隐藏吗? 创建控件时似乎相似。 我习惯于标准的asp .net c#web应用程序开发,所有的aspx页面都带有代码隐藏文件作为标准。 谢谢。

使用WebRequest获取cookie以自动登录Sharepoint Online,获取各种错误

我正在按照本教程远程validationSharepoint Online,但我是在C#中进行的。 Remote authentication in SharePoint Online 我可以从STS获得SAML没有问题,但我似乎无法将此令牌发送到Sharepoint以收回Cookie以便登录。以下是我的代码,请原谅任何明显的错误,我是新来的! //Send cookie to SPO. The token is from STS. byte[] spbyteArray = Encoding.UTF8.GetBytes(theToken); WebRequest sprequest = WebRequest.Create(“https://login.microsoftonline.com/login.srf?wa=wsignin1.0&rpsnv=2&ct=1335885737&rver=6.1.6206.0&wp=MBI&wreply=https%3A%2F%2Fcamida.sharepoint.com%2F_forms%2Fdefault.aspx&lc=1033&id=500046&cbcxt=mai&wlidp=1&guest=1”); sprequest.Method = “POST”; sprequest.ContentLength = spbyteArray.Length; sprequest.ContentType = “application/x-www-form-urlencoded”; sprequest.Headers.GetType().InvokeMember(“ChangeInternal”, BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.InvokeMethod, null, sprequest.Headers, new object[] { “Host”, “mydomain.sharepoint.com” }); Stream spdataStream = sprequest.GetRequestStream(); spdataStream.Write(spbyteArray, 0, spbyteArray.Length); spdataStream.Close(); […]

将SharePoint文件夹和内容移动到同一文档库中的不同位置

我正在寻找一种方法,使用SharePoint 2010客户端对象模型(C#)将文件夹及其所有内容移动到同一库中的其他位置。 例如,我们有一个项目的文件夹(比如12345),它的URL是 http://sharepoint/site/library/2012/12345 2012年代表一年。 我想以编程方式将12345文件夹移动到另一年,比如2014年可能已存在但可能不存在。 我一直在搜索,但我得到的解决方案似乎非常复杂,并且与将文件夹移动到不同的网站集有关,我希望因为它在同一个库中可能有一个更简单的解决方案? 我的一个想法是依靠Explorer View而不是CSOM? 非常感谢!

Sharepoint 2010 – 创建自定义菜单

有没有人知道一个很好的一步一步的教程来创建一个自定义菜单,如标准QuickLaunchMenu(SharePoint:AspMenu)或修改现有QuickLaunchMenu的好教程? 我想在站点地图中添加背景图片属性。 应在每个菜单项中呈现此图像。 我不知道如何创建一个costum菜单。 任何帮助,将不胜感激。 谢谢

SelectedIndexChanged不起作用!

我的代码: *的.aspx: * .aspx.cs: protected void Page_Load(object sender, EventArgs e) { CountryList.SelectedIndexChanged += new EventHandler(CountryList_SelectedIndexChanged); … } protected void CountryList_SelectedIndexChanged(object sender, EventArgs e) { LoadCityList(CountryList, CityList); } 但这不起作用。

GroupPrincipal方法FindByIdentity抛出奇怪的exception

我试图通过组名获取所有用户并在sharepoint webpart中显示它。 adGroupName类似=“CompanyGroup”。 GroupPrincipal grp = GroupPrincipal.FindByIdentity(ctx, IdentityType.Name, adGroupName); 例外: 为了执行此操作,必须在连接上完成成功绑定 为什么这样,我做错了什么? 堆栈跟踪: at System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail) at System.DirectoryServices.DirectoryEntry.Bind() at System.DirectoryServices.DirectoryEntry.get_AdsObject() at System.DirectoryServices.PropertyValueCollection.PopulateList() at System.DirectoryServices.PropertyValueCollection..ctor(DirectoryEntry entry, String propertyName) at System.DirectoryServices.PropertyCollection.get_Item(String propertyName) at System.DirectoryServices.AccountManagement.PrincipalContext.DoLDAPDirectoryInitNoContainer() at System.DirectoryServices.AccountManagement.PrincipalContext.DoDomainInit() at System.DirectoryServices.AccountManagement.PrincipalContext.Initialize() at System.DirectoryServices.AccountManagement.PrincipalContext.get_QueryCtx() at System.DirectoryServices.AccountManagement.Principal.FindByIdentityWithTypeHelper(PrincipalContext context, Type principalType, Nullable`1 identityType, String identityValue, DateTime refDate) at System.DirectoryServices.AccountManagement.Principal.FindByIdentityWithType(PrincipalContext context, Type principalType, IdentityType […]

使用camlQuery的Sharepoint 2010客户端对象模型 – 文件下载但没有内容/ 0字节

我正在尝试从文档库中的文件夹中的子文件夹下载txt文件。 我正在使用camlQuery来实现这一目标。 不幸的是,我没有得到txt文件的内容。 它有0个字节。 public void SaveFolderFiles(string fileName, string libraryName, ClientOM.ClientContext clientContext) { ClientOM.List sharedDocumentsList = clientContext.Web.Lists.GetByTitle(libraryName); ClientOM.CamlQuery camlQuery = new ClientOM.CamlQuery(); camlQuery.FolderServerRelativeUrl = “/Site/Folder/Folder2010/”; camlQuery.ViewXml = @” ” + fileName + @” 1 “; ClientOM.ListItemCollection listItems = sharedDocumentsList.GetItems(camlQuery); clientContext.Load(sharedDocumentsList); clientContext.Load(listItems); clientContext.ExecuteQuery(); if (listItems.Count == 1) { ClientOM.ListItem item = listItems[0]; Console.WriteLine(“FileLeafRef: {0}”, item[“FileLeafRef”]); Console.WriteLine(“FileDirRef: […]

如何使用客户端对象模型授予用户对某些文件夹的权限?

到目前为止,我可以使用以下代码授予用户某些权限: ClientContext context = new ClientContext(“http://myRealURL”); Principal user = context.Web.EnsureUser(@”myLoginAccout”); RoleDefinition readDef = context.Web.RoleDefinitions.GetByName(“Read”); RoleDefinitionBindingCollection roleDefCollection = new RoleDefinitionBindingCollection(context); roleDefCollection.Add(readDef); RoleAssignment newRoleAssignment = context.Web.RoleAssignments.Add(user, roleDefCollection); context.ExecuteQuery(); 上面的代码工作正常,现在我的任务是仅使用C#代码将用户权限添加到某些文件夹。 例如,在Libraries下,我有一个名为JZhu的库,在JZhu ,我有两个文件夹folder1和folder2 。 是否可以使用Client Object Model更改这两个文件夹的访问权限?

无法加载文件或程序集”或其依赖项之一

有什么帮助吗? 我只有一个图书馆,这让我发疯。 这是我收到的错误。 我没有使用任何其他依赖。 Could not load file or assembly ‘FOD.Intranet.Lib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=039c1f3a4c719e82’ or one of its dependencies. The system cannot find the file specified. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in […]

SharePoint 2010 – 客户端对象模型 – 向ListItem添加附件

我有一个SharePoint列表,我正在使用客户端对象模型添加新的ListItems。 添加ListItems不是问题,而且效果很好。 现在我想添加附件。 我以下列方式使用SaveBinaryDirect: File.SaveBinaryDirect(clientCtx, url.AbsolutePath + “/Attachments/31/” + fileName, inputStream, true); 只要我尝试添加附件的项目已经具有通过SharePoint网站添加的附件而不使用客户端对象模型,它就没有任何问题。 当我尝试将附件添加到没有任何附件的项目时,我会收到以下错误(两者都发生但没有相同的文件 – 但这两个消息始终显示): 远程服务器返回错误:(409)冲突 远程服务器返回错误:(404)Not Found 我想我可能需要先为这个项目创建附件文件夹。 当我尝试以下代码时: clientCtx.Load(ticketList.RootFolder.Folders); clientCtx.ExecuteQuery(); clientCtx.Load(ticketList.RootFolder.Folders[1]); // 1 -> Attachment folder clientCtx.Load(ticketList.RootFolder.Folders[1].Folders); clientCtx.ExecuteQuery(); Folder folder = ticketList.RootFolder.Folders[1].Folders.Add(“33”); clientCtx.ExecuteQuery(); 我收到一条错误消息: 无法创建文件夹“Lists / Ticket System / Attachment / 33” 我拥有SharePoint站点/列表的完全管理员权限。 我有什么想法可能做错了吗? 谢谢,Thorben