标签: sharepoint

AllowUnsafeUpdates的最佳模式

到目前为止,在我的研究中,我已经看到在GET请求操作上设置AllowUnsafeUpdates是不明智的,以避免跨站点脚本.但是,如果要求允许这样做,处理这种情况以减轻任何暴露的正确方法是什么?

如果您绝对需要在GET请求上允许Web或站点更新,这是我对可靠模式的最佳猜测.

最佳实践?

protected override void OnLoad(System.EventArgs e)
{
    if(Request.HttpMethod == "POST")
    {
        SPUtility.ValidateFormDigest();
        // will automatically set AllowSafeUpdates to true
    }

    // If not a POST then AllowUnsafeUpdates should be used only
    // at the point of update and reset immediately after finished

    // NOTE: Is this true? How is cross-site scripting used on GET
    // and what mitigates the vulnerability?
}

// Point of item update

    using(SPSite site = new SPSite(SPContext.Current.Site.Url, SPContext.Current.Site.SystemAccount.UserToken))
    {
        using (SPWeb web = site.RootWeb) …
Run Code Online (Sandbox Code Playgroud)

sharepoint spweb spsite

14
推荐指数
3
解决办法
2万
查看次数

开源SharePoint?

是否有SharePoint的开源替代方案?

我想要的东西提供相同的层次结构和基于portlet的SharePoint设计,但是在源代码中是开放的.基于Web的管理和定制也是一个优势.

sharepoint open-source

14
推荐指数
2
解决办法
2万
查看次数

如何删除网站模板?

我从我的一个站点创建了一个站点模板,现在我想删除它,但我找不到它在哪里.

我到处都看:(

我正在使用SharePoint Foundation 2010.

sharepoint sharepointfoundation2010

14
推荐指数
1
解决办法
5万
查看次数

我需要哪个SDK才能开始使用sharepoint.client.dll?

我想试用Microsoft.SharePoint.Client API. http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.client.aspx

我怎样才能获得Microsoft.SharePoint.Client.dll?

"SharePoint 2010参考:软件开发工具包"包含示例. http://www.microsoft.com/downloads/en/details.aspx?displaylang=en&FamilyID=f0c9daf3-4c54-45ed-9bde-7b4d83a8f26f

是否有一个具有DLL的SDK?

service sharepoint sdk client

14
推荐指数
2
解决办法
3万
查看次数

使用休息在Sharepoint中查询选择字段

我在Sharepoint 2010中获得了一个带有选择列的列表.选项是复选框.

如何使用其余的api查询选择列?

我试过用了

http://sp2010/_vti_bin/listdata.svc/mylist?$filter=myChoicesColumn/xxx eq something 
Run Code Online (Sandbox Code Playgroud)

然后我明白了

类型'System.Collections.Generic.IEnumerable`1 [[Microsoft.SharePoint.Linq.DataServiceEntity,Microsoft.SharePoint.Linq,Version = 14.0.0.0,Culture = neutral,PublicKeyToken = 71e9bce111e9429c]]'中不存在属性'xxx'在第6位.

我应该使用什么属性?

rest sharepoint

14
推荐指数
2
解决办法
1万
查看次数

使用R连接到共享点列表

有没有人能够将R中的SharePoint列表导入为数据帧?

我有两个单独的数据源,一个来自SharePoint列表,另一个来自我希望运行分析的数据库.我能够毫无问题地连接到数据库,但似乎无法找到连接到SharePoint列表的任何内容.

SharePoint服务器是2007

sharepoint r sharepoint-list dataframe

14
推荐指数
1
解决办法
1万
查看次数

Sharepoint 2013和Oauth 2.0

我需要澄清Sharepoint如何使用Oauth以及我可以/不能使用持有者令牌.

我希望能够做的是从Sharepoint检索持有者令牌,通过javascript跨域和/或设置Sharepoint以使用与我当前的Oauth服务器相同的机器密钥.

我已经阅读了本文和其他几篇文章的大部分内容,但它让我在没有明确例子的情况下蹦蹦跳跳.:https: //msdn.microsoft.com/en-us/magazine/dn198245.aspx

概括:

  1. 我需要一个代码片段,用于使用Javascript,跨域和...从Sharepoint检索持有者令牌.

  2. 我需要与Oauth 2.0共享基于声明的承载令牌的相同机器密钥

并澄清我正在尝试做什么:

我需要读取/写入来自不同平台的Sharepoint列表,我想要一种标准的方法来实现它.REST似乎是要走的路.我们的应用程序正在使用RESTful服务和Oauth开发.我们已经用html和javascript覆盖了所有这些.我想了解如何继续使用我们当前的Oauth和REST模式在我们的html应用程序以及使用基于声明的承载令牌的Java和C#上创建安全的Sharepoint接口.如果我走在正确的轨道上,请确认并提供一些明确的示例/资源.如果有更好的方法来做到这一点,我会全力以赴.

sharepoint oauth

14
推荐指数
1
解决办法
755
查看次数

使用RunWithElevatedPrivileges时如何更改"Modified By"?

我们有一个Web部件,可以将文档上载到文档库.上载文档的用户可能无法访问目标位置,因此添加文件的代码在RunWithElevatedPrivileges块中执行.这意味着"修改者"字段始终设置为"系统帐户".这是代码:

SPSecurity.RunWithElevatedPrivileges(
    delegate
    {
        using (SPSite elevatedSite = new SPSite(SPContext.Current.Site.Url))
        using (SPWeb targetWeb = elevatedSite.OpenWeb(webUrl))
        {
            targetWeb.AllowUnsafeUpdates = true;
            SPFile newFile = files.Add(filename, file);
            SPListItem item = newFile.Item;

            // TODO: Insert code to set Modified By

            item.SystemUpdate();
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

需要将"Modified By"字段设置为当前用户的名称(在上面的TODO行中),但以下尝试均未起作用:

item["Modified By"] = SPContext.Current.Web.CurrentUser;

item["Author"] = SPContext.Current.Web.CurrentUser;

item["Modified By"] = new SPFieldUserValue(
SPContext.Current.Web, SPContext.Current.Web.CurrentUser.ID,
SPContext.Current.Web.CurrentUser.Name);

item["Author"] = new SPFieldUserValue(
SPContext.Current.Web, SPContext.Current.Web.CurrentUser.ID,
SPContext.Current.Web.CurrentUser.Name);
Run Code Online (Sandbox Code Playgroud)

有没有人知道允许更改"修改者"值的解决方案?

security sharepoint

13
推荐指数
2
解决办法
1万
查看次数

团队系统 - 为现有团队项目创建Sharepoint项目门户

我在Team System 2010中有一个现有的Team Project,当我最初创建它时,我选择创建Sharepoint Project Portal网站.我现在想要团队项目的Sharepoint项目门户网站.

我该怎么做呢?

在Visual Studio中,我曾尝试Team->团队项目设置 - >门户网站设置...,并检查"'使团队项目门户’,但我得到的错误:

TF229003:未收到以下SharePoint站点的响应:htttp:/.验证它是否可操作,或指定其他站点

sharepoint tfs visual-studio-2010 tfs2010

13
推荐指数
2
解决办法
8490
查看次数

检测ClientObject属性是否已被检索/初始化的正确方法

如果您正在使用SharePoint中的客户端对象模型,并且访问尚未初始化或已由其检索的属性

Context.Load(property); 
Context.ExecuteQuery();
Run Code Online (Sandbox Code Playgroud)

你得到一个例子:

Microsoft.SharePoint.Client.PropertyOrFieldNotInitializedException

要么

该集合尚未初始化.它没有被请求或者请求没有被执行.

例外.

如果已经初始化/检索这些属性,是否有任何正确的方法可以检查它们?没有Try/Catch方法.我不喜欢那个人.

我想在抛出异常之前检查并处理它.

我已经查过了

IsObjectPropertyInstantiated

IsPropertyAvailable

方法,但他们没有帮助.IsPropertyAvaiable仅检查标量属性,并且不会给出结果,例如Web.Lists,虽然未初始化IsObjectPropertyInstantiated,Web.Lists但返回true Web.Lists.

c# sharepoint csom

13
推荐指数
1
解决办法
1万
查看次数