标签: sharepoint-2013

为什么PreApplicationStartMethodAttribute()在SharePoint 2013中不起作用?

在.NET 4(.5)中有这样的惊人Attribute:PreApplicationStartMethodAttribute我想在SharePoint 2013中使用它,所以我不必直接app_startglobal.asax文件中编辑方法.

由于SP2013运行的是正确版本的.NET,我认为这个属性可以正常工作......但似乎并非如此.

有没有人想出如何使用它?或解释为什么它不能工作?

小更新:在我看到的system.web dll中,PreApplicationStartMethodAttribute由下面的类调用.

// System.Web.Compilation.BuildManager
internal static ICollection<MethodInfo> GetPreStartInitMethodsFromAssemblyCollection(IEnumerable<Assembly> assemblies, bool buildingFromCache)
{
    List<MethodInfo> list = new List<MethodInfo>();
    foreach (Assembly current in assemblies)
    {
        PreApplicationStartMethodAttribute[] array = null;
        try
        {
            array = (PreApplicationStartMethodAttribute[])current.GetCustomAttributes(typeof(PreApplicationStartMethodAttribute), true);
        }
        catch
        {
        }
        if (array == null || !array.Any<PreApplicationStartMethodAttribute>())
        {
            if (buildingFromCache)
            {
                return null;
            }
        }
        else
        {
            PreApplicationStartMethodAttribute[] array2 = array;
            for (int i = 0; i < …
Run Code Online (Sandbox Code Playgroud)

sharepoint routing global-asax sharepoint-2013

6
推荐指数
1
解决办法
2058
查看次数

JavaScript Object.create和IE8

我正在为SharePoint 2013进行软件开发.其中一部分涉及覆盖SharePoint的文件预览器(filepreview.debug.js成为myfilepreview.debug.js).但是,我们遇到了IE8的问题.在IE9中一切正常.

IE8中引发的错误会导致您在网站集中访问的任何网站上出现错误,我们的自定义功能已激活:"对象不支持此属性或方法"

在对此错误进行一些研究后,似乎 IE8根本不支持Object.create.这篇Mozilla开发者帖子似乎支持这一理论.当问题通过在抛出错误的行之前添加此polyfill代码来解决问题时,我更加迫切地相信这一点:

if (typeof Object.create !== 'function') {
    Object.create = function (o) {
        function F() { }
        F.prototype = o;
        return new F();
    };
}
Run Code Online (Sandbox Code Playgroud)

我想这有意义,因为它模仿了Object.create的功能,据说IE8不支持它.

但是,这很令人困惑,因为SharePoint的文件预览器javascript工作得很好.他们的javascript 使用Object.create.甚至更奇怪,在我们的javascript中抛出错误的代码部分甚至不是我们的代码 - 它是SharePoint的.到目前为止,整个javascript代码实际上与SharePoint相同,除了几行.

这是默认值,直到有问题的行:

function $_global_filepreview() {
RegisterSod("mediaplayer.js", "_layouts/15/mediaplayer.js");
RegisterSod("sp.publishing.resources.resx", "/_layouts/15/ScriptResx.ashx?name=sp.publishing.resources&culture=" + STSHtmlEncode(Strings.STS.L_CurrentUICulture_Name));
RegisterSodDep("mediaplayer.js", "sp.publishing.resources.resx");
previewBase = (function() {
ULS7RK:
    ;
    var filePreviewUniqueId = 0;

    return {
        init: function(ctxT, listItem, extension) {
            this.fpId = ++filePreviewUniqueId;
            this.fpDomId = "FilePreviewID-" + String(this.fpId);
            this.fpCtx = ctxT;
            this.fpExtension …
Run Code Online (Sandbox Code Playgroud)

javascript c# sharepoint internet-explorer-8 sharepoint-2013

6
推荐指数
1
解决办法
2683
查看次数

/_vti_bin/client.svc有404错误

每当我尝试保存时,我都会收到此错误(通过javascript控制台)

POST https://domain.local/_vti_bin/client.svc/ProcessQuery 404(未找到)

有任何想法吗?

sharepoint-2013

6
推荐指数
1
解决办法
1552
查看次数

在Custom webpart中使用sharepoint OOTB DragDrop.js库

我在webpart中使用REST api实现了拖放文件上传功能.但我找到了一个OOTB sharepoint dragdrop.js库,它有许多方法来创建拖放控件.有没有人有一个使用这个OOTB dragdrop.js创建一个拖拽控件的例子?

提前致谢.

sharepoint sharepoint-2013 csom

6
推荐指数
0
解决办法
1051
查看次数

Objective-C中的Sharepoint 365 ACS OAuth:领域错误 - 需要帮助

好的,所以我们正在构建一个iPhone应用程序来访问Office 365上托管的Sharepoint 2013网站.如果我在C#中构建这个,我已经完成了,我会很高兴只使用TokenHelper.cs来获取我大部分时间都在那里.不幸的是,据我所知,Objective-C还没有TokenHelper.

所以这是交易,我们已经可以成功获得OAuth身份验证/授权页面,我们成功获得了授权码.

在此之后我们感到难过,因为我们知道我们在POST中缺少了用于获取Access和Refresh令牌的域ID.我终于想出了TokenHelper是如何做到的,我们已经重复了这一点.(这是对/_vti_bin/client.svc的额外调用,您希望获得401,以便您可以从标头中提取领域ID)

我们现在有一个领域ID,从我在文档中看到的和TokenHelper以及在Fiddler中看到的,需要在以下两种方式中使用:在POST的URL构造内以及在文档中的资源值.该POST的标题.

所以POST网址看起来像这样:

accounts.accesscontrol.windows.net/{realm id}/tokens/oauth/2

我们的资源价值如下:

resource = 00000003-0000-0ff1-ce00-000000000000%2f {realm url}%40 {realm id}

这至少连接正常并接受我们的POST.不幸的是,我们收到以下消息:

ACS50012:身份验证失败.ACS90011:领域''不是当前服务命名空间的已配置领域.

这条消息让我觉得可能存在配置问题,但我真的无法确定.

有没有其他人尝试在Objective-C中对365网站执行OAuth并取得了成功?

我也可以发布代码,但我最初还是试图回避这个问题.

sharepoint objective-c oauth-2.0 acs sharepoint-2013

6
推荐指数
1
解决办法
886
查看次数

Sharepoint Designer 2013 - 如何添加Web部件区域?

我在Sharepoint 2013中遇到了问题.

我正在使用Designer 2013,我正在尝试添加另一个Web部件区域.从图中可以看出,左侧有一个Web部件区域.我知道如何减小Web部件区域的宽度,因此有另一个空间.但我不知道,如何实际添加新的Web部件区域.

Designer 2013没有设计视图.
有没有人知道我这次可以在右边添加一个Web部件区域?

提前致谢.

问题

sharepoint-2013

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

SharePoint中的供应站点,列表,库等

以前在SharePoint中配置列表,库,站点列,内容类型,列表定义等时,我通常使用通过WSP部署的SharePoint功能 - 或使用PowerShell脚本.这意味着我有一个可以部署到DEV/TEST/PROD的软件包.

我在Office 365中使用SharePoint,并且不确定在SharePoint中配置列表/库/功能的最佳方法.

选项:

没有代码沙盒解决方案 试图避免使用这些来自Microsoft的信息是否被弃用 - 但沙盒解决方案将允许我部署具有列表定义的功能等.我知道使用c#的沙盒解决方案肯定已被弃用,但是周围的信息没有代码解决方案很差.

应用程序 我知道应用程序可以在应用程序和主机Web级别进行配置,但使用CSOM创建列表,库等似乎需要付出很多努力并且倒退一步.

PowerShell SP在线PowerShell远不如内部SP强大.我可以通过这个来配置网站集,但不是列表或库...

我很想知道其他开发人员如何部署到Office 365,特别是关于使用特定列表定义,库,内容类型等配置站点...

谢谢

sharepoint office365 sharepoint-2013

6
推荐指数
1
解决办法
2082
查看次数

代码给出了错误,"ReferenceError:CryptoJS未定义",而我已经包含了必需的.js引用,这是什么原因?

这是我的代码,我已经包含了以下.js文件,onpage load它给出了错误"ReferenceError:CryptoJS未定义"为什么它在添加了js引用时会给出错误.我正在使用Office 365创建一个sharepoint-2013应用程序.

<script type="text/javascript" src="../Scripts/sha1.js"></script>
<script type="text/javascript" src="../Scripts/hmac-sha1.js"></script>

  'use strict';

var context = SP.ClientContext.get_current();
var user = context.get_web().get_currentUser();

(function () {

    // This code runs when the DOM is ready and creates a context object which is 
    // needed to use the SharePoint object model
    $(document).ready(function () 
    {
        getUserName();

        $("#button1").click(function()
        {
                paraupdate();   
        });

    });

    // This function prepares, loads, and then executes a SharePoint query to get 
    // the current users information

    function paraupdate()
    {

        var str=""+$("#textbox1").val();
        alert(""+str);
        var …
Run Code Online (Sandbox Code Playgroud)

javascript ajax json sharepoint-2013

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

Sharepoint 2013 MVC 5提供商托管的应用程序.无法使用[SharePointContextFilter]在HttpPost上进行身份验证

过去一周我一直在敲打我的头脑,无法解决针对sharepoint提供商托管应用程序的正确身份验证的一些问题.

我目前正在为公司的Sharepoint在线开发一个sharepoint应用程序.我正在使用Visual Studio 2013.我将该应用程序部署为公司的Windows Azure门户上的云服务.一切顺利到我需要制作HttpPost的时候,然后应用程序无法进行身份验证.Conroller的设计如下:

    [SharePointContextFilter]
    public ActionResult Index()
    {
        UserSingleton user_temp = UserSingleton.GetInstance();

        User spUser = null;

        SharePointContext spContext = SharePointContextProvider.Current.GetSharePointContext(HttpContext);

        using (var clientContext = spContext.CreateUserClientContextForSPHost())
        {
            if (clientContext != null)
            {
                spUser = clientContext.Web.CurrentUser;

                clientContext.Load(spUser, user => user.Title, user => user.Email);

                clientContext.ExecuteQuery();

                ....code....

            }
        }

           ....code....

        return View();
    }
Run Code Online (Sandbox Code Playgroud)

加载索引页面很顺利,操作会创建用户上下文,这一切都很好.当我尝试提交HttpPost时问题就出现了:

    [HttpPost]
    [ValidateAntiForgeryToken]
    [SharePointContextFilter]
    public ActionResult GetService(System.Web.Mvc.FormCollection fc)
    {
        PlannedHours ph = this.PopulateModel(fc);

        if (ph == null)
            return View("NoInfoFound");

        ViewData["PlannedHours"] = ph;

        return View("Index");
    }
Run Code Online (Sandbox Code Playgroud)

当我通过帖子按钮拨打此电话时,我收到"无法确定您的身份.请通过启动您网站上安装的应用再试一次." Shared/Error.cshtml视图.问题是当我删除[SharePointContextFilter]然后它工作,但这意味着请求不通过[SharePointContextFilter]因此它没有正确认证?或者是吗?因为它无法验证用户的合法性.

当我不删除[SharePointContextFilter]并调用帖子时,我注意到的一件事情,那么网址最终没有{StandardTokens}查询.是假设是这样的 - …

sharepoint-2013 asp.net-mvc-5

6
推荐指数
2
解决办法
9994
查看次数

如何从客户端Web部件内容页面中保留Web部件状态?

我刚刚设置并创建了第一个SharePoint开发工作:一个用于Web部件的项目,将在SharePoint Online实例(我的Office 365试用版)中托管.

我已经想出如何使用List API来提取我应该呈现的内容,作为横幅图像的旋转列表,但我还有一个问题.我想跟踪列表中的位置,以及最后一次更改图像的时间.如果我使用本地存储,我的另一个问题很好地回答了这个问题,但是我可以使用任何SharePoint REST或JSOM API在SharePoint服务中保持这种状态吗?

sharepoint web-parts sharepoint-api sharepoint-2013

6
推荐指数
1
解决办法
147
查看次数