昨天在写SharePoint EventReceiver的时候遇到一个问题,创建了一个local farm SharePoint solution,添加了一个ItemAdded(SPItemEventProperties properties)事件,更新field name为Workflow的value。

public override void ItemAdded(SPItemEventProperties properties)
{
base.ItemAdded(properties);
if (properties.AfterProperties["Workflow"] != null)
{
string value = properties.AfterProperties["Workflow"].ToString();
if (!string.IsNullOrEmpty(value))
{
properties.ListItem["Workflow"] = string.Empty;
properties.ListItem.SystemUpdate();
}
}
}

上传已包含custom field为Workflow的office file,发现properties.AfterProperties["Workflow"]这个field value一直是空。百思不得其解,向大神求教。

大神还是很热心的,下面是回复的内容:

I did a test and found that the property will be added when the file saved to the document library, here is our steps and some codes, please point out if we have some settings different from your enviroment:

1、Create 2 Document libraries(LibA and LibB),both of  them contain one column field name "SyncType"

2、Create a Document in office Client, upload it to LibA ,and set the SyncType to 1

3、Now web download the file, open it in office client, click File->Show All Properties in the right bottom, we can see this property

4、Now we created a project, I used sandboxed solution, add an Event Receiver,and I used the following codes to proceed the action(get value and reset it):

 

public override void ItemAdded(SPItemEventProperties properties)
{
base.ItemAdded(properties);
try
{
var value = properties.AfterProperties["SyncType"].ToString();
if (!string.IsNullOrEmpty(value))
{
properties.ListItem["SyncType"] = string.Empty;
properties.ListItem.SystemUpdate();
}
}
catch (Exception)
{
throw;
}
}

  5、Then I click the document I uploaded to LibA, then select open it in office client, then File->Save As, save it to the LibB,and seems everything works fine.

please let us know if we missed something.

以上是大神回复的大部分内容,瞬间被大脸,怎么回事,为什么在我这里不好用,大神确认证成功。经过昨天一下午不懈努力,终于发现了问题所在,原来是solution type的原因,sandbox solution确实可以,但是local farm solution 存在这个问题。

下面是我重现的步骤,本人也是第一次创建sandbox solution,记录了一下过程

1、创建一个sandbox solution,添加如上代码

2、Deployee solution,Site Setting->Web Designer Galleries ->Solution, check the Status is Actived

3、Attach process,if the solution endpoint is not trigger, please End process SPUCWorkerProcess.exe then retry.

果然,验证成功!

SharePoint 2013 Sandbox Solution的更多相关文章

  1. VS2012 开发SharePoint 2013 声明式workflow action(activity)之 HelloWorld

    本文讲述VS2012 开发SharePoint 2013 声明式workflow action 之 HelloWorld. 使用VS2012开发客户化的workflow action是SharePoi ...

  2. 使用VS2012 开发SharePoint 2013 声明式的action(activity) 综合实例

    本文讲述使用VS2012 开发SharePoint 2013 声明式的action 综合实例. 需求同: http://blog.csdn.net/abrahamcheng/article/detai ...

  3. SharePoint 2010升级到sharePoint 2013后,人员失去对网站的权限的原因及解决方法。The reason and solution for permission lost after the upgrading

    昨天碰到了一个问题,一个网站在从SharePoint 2010升级到SharePoint 2013后,人员都不能登录了,必须重加赋权,人员才能登录,这样非常麻烦. 原因:是认证方式的问题.在Share ...

  4. 实现一个基于 SharePoint 2013 的 Timecard 应用(上)

    在 SharePoint 2013 上面实现一个 Timecard 应用的想法来自一个真实的需求,而实现的方案在我脑海里面盘旋已经很久了,终于这几天准备安排点儿时间将它实现出来. “ We start ...

  5. 实现一个基于 SharePoint 2013 的 Timecard 应用(中)

    门户视图 随着 Timecard 列表的增多,如何查找和管理这许多的 Timecard 也就成了问题.尤其对于团队经理而言,他除了自己填写的 Timecard,还要审核团队成员的 Timecard 任 ...

  6. Integrating SharePoint 2013 with ADFS and Shibboleth

    Time again to attempt to implement that exciting technology, Federation Services (Web Single Sign On ...

  7. [转]安装SharePoint 2013时安装AppFabric失败(错误码:1603)

    转自:http://blogs.technet.com/b/praveenh/archive/2013/02/22/sharepoint-2013-prerequisites-fails-with-m ...

  8. 使用C#代码部署SharePoint 2013开发包简单总结(一)

    这篇文章将总结下如何将自己开发的列表.Web部件.事件接收器等元素部署到SharePoint的服务器.因水平有限,我的做法未必是最佳实践,会有些错误理解和疏漏,欢迎各位高手批评指正——但一定要能给出更 ...

  9. SharePoint 2013 为用户组自定义EventReceiver

    前 言 在SharePoint的开发中,EventReceiver是很重要的一个部分,但是,常常遇到有些需要事件的时候,却没有相应的模板,因为EventReceiver创建时的模板只有那几个,除此之外 ...

随机推荐

  1. 利用window对象下内置的子对象实现网页的刷新

    这里我们用到的window对象下内置的子对象有:     1.history对象:包含浏览器访问过的url.我们可以利用它的history.go(num);属性实现页面的刷新:           h ...

  2. 【系统解读】SystemUI篇(一)SystemUI启动流程

    前言 SystemUI是系统启动中第一个用户肉眼可见的应用,其功能包罗万象,比如开机后看到的锁屏界面,充电时充电界面,状态栏,导航栏,多任务栏等,都是与Android手机用户息息相关的功能.所以不止S ...

  3. A-Graph Games_2019牛客暑期多校训练营(第三场)

    题意 给出一张无向图,定义S[x]表示与点x直接相连的点集,有两个操作 1 x y表示将第x到第y条边状态变化(若存在则删除,不存在则建立) 2 x y询问S[x]与S[y]是否相等 题解 有一个技巧 ...

  4. HDU-DuoXiao第二场hdu 6315 Naive Operations 线段树

    hdu 6315 题意:对于一个数列a,初始为0,每个a[ i ]对应一个b[i],只有在这个数字上加了b[i]次后,a[i]才会+1. 有q次操作,一种是个区间加1,一种是查询a的区间和. 思路:线 ...

  5. 模板汇总——treap

    1. 旋转treap. 思想:一颗权值BST + 一颗 随机数 最小堆. BZOJ - 3224 代码: #include<bits/stdc++.h> using namespace s ...

  6. 解决flutter:unable to find valid certification path to requested target 的问题

    1.问题 周末在家想搞搞flutter,家里电脑是windows的,按照官网教程一步步安装好以后,创建flutter工程,点击运行,一片红色弹出来,WTF? PKIX path building fa ...

  7. 面向微服务的体系结构评审中需要问的三个问题-咖啡杂谈:Java、新闻、故事和观点

    面向微服务的体系结构如今风靡全球.这是因为更快的部署节奏和更低的成本是面向微服务的体系结构的基本承诺. 然而,对于大多数试水的公司来说,开发活动更多的是将现有的单块应用程序转换为面向微服务的体系结构, ...

  8. Python---列表的学习(一)

    本文将介绍列表和列表的使用: 我对列表的理解是和c,c++中的数组,vector,数据结构-链表-栈-队列,都很相似,因此列表很强大(相对于c,c++来说),所以在python的学习中列表是个重点. ...

  9. springboot2之结合mybatis增删改查解析

    1. 场景描述 本节结合springboot2.springmvc.mybatis.swagger2等,搭建一个完整的增删改查项目,希望通过这个基础项目,能帮忙朋友快速上手springboot2项目. ...

  10. Jenkins流水线(pipeline)实战之:从部署到体验

    关于Jenkins流水线(pipeline) Jenkins 流水线 (pipeline) 是一套插件,让Jenkins可以实现持续交付管道的落地和实施. 关于blueocean Blue Ocean ...