Tag: sharepoint 2010

如何在SharePoint 2010中获取服务应用程序权限

在SharePoint 2010中读取特定服务应用程序的帐户权限的最佳/最简单方法是什么? 目前我一直在搞乱: var solution = SPFarm.Local.Solutions[“Service App Name.wsp”]; var solutionPermissions = solution. //trying different options here 我一直在寻找可以遵循“解决方案”的不同选项。 但到目前为止,我感到很茫然。 有任何想法吗?

参考Microsoft.SharePoint.dll

我有一个Shrepoint安装在其上的服务器。 我想测试这段代码: SPUtility.GetLocalizedString方法 当我添加对Microsoft.SharePoint.dll的引用时,我可以解析SPSite和…。问题是当我想要构建项目时,它无法再using Microsoft.SharePoint识别: 我收到此错误: 错误13名称空间“Microsoft”中不存在类型或命名空间名称“SharePoint”(您是否缺少程序集引用?) 问题出在哪儿? 我添加了对Microsoft.SharePoint.dll引用,但在构建时它不起作用

使用UserProfileManager获取随机用户

我正在尝试为我正在开发的SharePoint 2010项目创建“Who is”Web部件。 此Web部件应该从SharePoint配置文件中选择一个随机用户,并显示他/她的姓名,部门和电话。 问题是我无法找到直接从用户配置文件中获取随机用户的方法,这就是我想要做的。 我找到了一种方法: SPServiceContext myContext = SPServiceContext.GetContext(mySite); SPWeb myWeb = SPContext.Current.Web; UserProfileManager profileManager = new UserProfileManager(myContext); bool boolOut; SPPrincipalInfo[] userInfos = SPUtility.GetPrincipalsInGroup(myWeb, “AllUsers”, profileManager.Count, out boolOut); Random random = new Random(); int randomUser = random.Next(0, userInfos.Length); SPPrincipalInfo user = userInfos[randomUser]; bool userFound = false; while(!userFound) { if (profileManager.UserExists(user.LoginName)) { UserProfile userProfile = […]

CAML查询到SharePoint列表返回整个集

我一直遇到一个问题,如果我在C#中执行CAML查询,我的ListItemCollection包含整个列表。 这是我擦洗代码的片段,也许你可以看到我做错了什么。 在调试时,我发现生成的XML是我从文件中读取的值所期望的。 实际执行查询和加载结果似乎存在问题。 我在这里做的步骤对我来说似乎不正确,我觉得我错过了一步。 using Microsoft.SharePoint.Client; … System.Net.NetworkCredential credentials = new System.Net.NetworkCredential(user, password, domain); ClientContext clientContext = new ClientContext(uri); clientContext.Credentials = credentials; List list = clientContext.Web.Lists.GetByTitle(listName); //read line of input from file and save to string[] CamlQuery camlQuery = new CamlQuery(); camlQuery.ViewXml = “” + columns[2].Trim() + “” + columns[0].Trim() + “” + columns[1].Trim() […]

SharePoint安全validation更新元数据时出现问题(此页面的安全validation无效)

我从aspx.cs调用此方法时出现此错误。 此页面的安全validation无效。 在Web浏览器中单击“上一步”,刷新页面,然后再次尝试操作 //SPUtility.ValidateFormDigest(); // still not working although I added it later //hit the error here **** if I add using (SPSite site = new SPSite(spServerURL)) { using (SPWeb oWebsite = site.OpenWeb()) { SPSecurity.RunWithElevatedPrivileges(delegate() { using (SPSite elevatedSite = new SPSite(site.ID)) { using (SPWeb elevatedWeb = elevatedSite.OpenWeb(oWebsite.ID)) { if (elevatedWeb.GetFile(DocumentLibraryName + “/” + folderName […]

SharePoint 2010 – API / arhitecture /组件详细信息

我即将着手开发SharePoint 2010开发,并从开发人员的角度来看它需要一些细节。 我观看了无数的video,描述了如何创建网站,视图,管理文档等,但找不到任何有用的开发资源(或者我没有找到正确的地方……我不知道)。 所以,我的问题是,我在哪里可以找到API信息,组件详细信息,SharePoint 2010如何在其下构建,以及如何使用它。 我需要一些在线资源来快速地让我加快速度,并在以后作为参考文档。 我在哪里可以找到这样的信息?

使用客户端对象模型在线访问SharePoint – 禁止错误

我尝试使用客户端对象模型创建一个新的列表项。 我已经创建了一个asp.net应用程序来完成任务。 如果我传递安装在我的计算机中的SharePoint服务器的URL,它就可以工作。 但是,如果我提供我的SharePoint在线URL,它将无法正常工作,如下面的代码所示。 我得到“远程服务器返回错误:(403)禁止。”错误。 任何的想法? ClientContext context = new ClientContext(“https://xxx.sharepoint.com/SitePages/”); List announcementsList = context.Web.Lists.GetByTitle(“Announcements”); ListItemCreationInformation itemCreateInfo = new ListItemCreationInformation(); Microsoft.SharePoint.Client.ListItem newItem = announcementsList.AddItem(itemCreateInfo); newItem[“Title”] = result.City; newItem[“Body”] = result.State; newItem.Update(); context.ExecuteQuery();

删除控件中的所有项目

我目前有一个Sharepoint 2010 Web部件,其中包含多个标签。 我想以编程方式删除除这些标签之外的所有标签。 我尝试了下面的代码,但得到了一个System.InvalidOperationException因为显然在迭代它时不能修改集合。 但是,我不知道怎么试试这个。 private void clearLabels() { foreach (Control cont in this.Controls) if (cont is Label && cont.ID != “error”) this.Controls.Remove(cont); }

如何通过标准Web服务之一将文件上载到SharePoint库

我必须将一些XML文件上传到SharePoint库。 我必须从不是SharePoint服务器之一的计算机上执行此操作(因此对象模型将无法工作)。 该库还有一个自定义(整数)列,我必须为上传的文件设置它的值。 如何使用SharePoint 2010的标准WebServices上载文件和值?

validation网络凭据以访问客户端对象模型上的SharePoint站点

我正在使用小应用程序,这需要将所有用户都带到给定站点的所有组中。 我有两个网站; SharePoint 2010在线运行和SharePoint 2013在线运行。 我收到凭据错误… {“The remote server returned an error: (401) Unauthorized.”} 码。 public class Program { static void Main(string[] args) { string _siteURL = “https://intranet.co.uk”; NetworkCredential _myCredentials = new NetworkCredential(“user”, “password”, “https://intranet”); ClientContext _clientContext = new ClientContext(_siteURL); _clientContext.Credentials = _myCredentials; Web _MyWebSite = _clientContext.Web; GroupCollection _GroupCollection = _MyWebSite.SiteGroups; _clientContext.Load(_GroupCollection); _clientContext.Load(_GroupCollection, groups => […]