首页 \ 问答 \ Sharepoint 2013 - 通过REST api仅获取上次批准的版本(Sharepoint 2013 - Fetch only last approved version through REST api)

Sharepoint 2013 - 通过REST api仅获取上次批准的版本(Sharepoint 2013 - Fetch only last approved version through REST api)

在我提出问题之前,我想简要介绍一下这个主题。

我获得了一个启用了内容审批功能的sharepoint列表(SP 2013)。 对于此列表,您可以选择应该查看项目草稿版本的人员。 这里的大多数逻辑选项是让作者和所有批准者看到草稿。 现在想象一个项目已被批准,现在再次编辑。 有一个版本是草稿(因为它需要再次批准)和之前已经批准的版本。

这是棘手的部分:-)。 我通过REST api获取该列表的项目。 我的查询包括“_ModerationStatus eq 0”,这意味着我只获取已批准的项目。 不允许查看草稿的用户自动获得该项目的最后批准版本,尽管有一个草稿版本等待批准。 允许查看草稿版本的用户看到(我希望这里有不同的东西)没有! 因此,对于能够查看草稿的用户而言,查询不会获取最后批准的项目。 现在如果我执行没有“_ModerationStatus eq 0”的查询,这些用户会看到草稿版本,而其他人(不允许看草稿)仍然会看到最后批准的版本。

所以最后我的问题是:有没有机会改变这种感觉? 我希望SP通过REST api返回所有用户的最后批准版本。 如果这些用户打开SP列表本身,他们肯定会看到草稿。 所以它只是关于其余的api。

我不认为这是可能的(没有找到任何改变它的东西)而且我认为REST api只是反映了SP列表视图本身的本机视图行为的行为。

先谢谢你! 对本


Before I ask my question I want to give you a quick overview about the topic.

I got a sharepoint list (SP 2013) which has content approval feature enabled. For this list you can choose who should see the draft versions of an item. Most logic option here is to let the author and all approvers see the draft. Now imagine that an item has been approved and now again edited. There is a version that is draft (because it needs to be approved again) and a version that had been approved before.

Here comes the tricky part :-). I fetch the items of that list via REST api. My query includes "_ModerationStatus eq 0" which means that I only fetch approved items. Users who are not allowed to see drafts automatically get the last-approved version of the item, although there is a draft version waiting to be approved. Users who are allowed to see draft versions see (I would expect something different here) NOTHING! So instead of fetching the last-approved item, the query has no result for users which are able to see drafts. Now if I perform the query without "_ModerationStatus eq 0" these users see the draft version while others (not allowed to see drafts) still see the last-approved version.

So finally my question is: Is there any chance to change this beaviour? I want SP to return the last approved version for ALL users via REST api. If these users open the SP-list itself they sure should see the draft. So it is only about the rest api.

I don´t think that this is possible (did not find anything to change this) and I thik the REST api just mirrors the behaviour of the native view behaviour of the SP-list-view itself.

Thank you in advance! regards Ben


原文:https://stackoverflow.com/questions/26054246
更新时间:2022-03-25 22:03

最满意答案

我想知道为什么你甚至有两个不同的子类,如果它是一种自然的情况,你想从一种类型转换到另一种类型。 我认为你应该重构你所拥有的东西,并使买方和供应商成为一个实体。 然后,如果您的行为根据客户是否为买方或供应商而有所不同,我会将其解压缩为可以设置或添加到客户端的单独对象。


I am wondering why you even have the two different sub classes if it is a natural situation that you want to change from one type to the other. I think that you should refactor what you have and make the buyer and supplier one entity. Then if you have behavior that should be different based on whether or not the client is a buyer or supplier I would extract that into a seperate object which you can set or add to the client.

相关问答

更多
  • 您可以通过在您的datacontext上实现LINQ to SQL将调用的部分类来覆盖Update方法。 只要给它签名: partial void UpdateClassName(ClassName instance) 您也可以通过它通常使用的内容: ExecuteDynamicInsert(instance); 不幸的是,没有任何机制只是为了插入/更新/删除而获得预期的SQL(您可以在DataContext上使用GetCommand获取SELECT语句) You can override the Upda ...
  • 在这种情况下: select (p.st_fname ?? "This is empty") + " " + (p.st_mname ?? "This is empty") + " " + (p.st_lname ?? "This is empty"); 或者,如果它只是可以为空的最后一个名字: select p.st_fname + " " + p.st_mname + " " + (p.st_lname ?? "This is empty"); ?? ?? 运算符 ...
  • 以下是关于将对象转换为派生类的一些答案。 是否可以使用C#中的显式类型转换将基类对象分配给派生类引用? 将基类转换为派生类 答案是否定的,这是不可能的。 最简单的方法是执行您的建议:创建DerivedClass(BaseClass)构造函数 Here is some answers about casting objects to derived classes. Is it possible to assign a base class object to a derived class referenc ...
  • 我不能告诉你为什么它在Linq2SQL中工作而不在Entity Framework中,但我可以帮助你解决你的问题。 我建议你使用SqlFunctions.StringConvert函数。 var data = db.Clients.Select(c => SqlFunctions.StringConvert((double)c.Id) + ":" + c.Firstname); 就个人而言,如果我必须进行任何字符串操作,我会尝试将其放在我的客户端代码中,如下所示: var data = db.C ...
  • 我想知道为什么你甚至有两个不同的子类,如果它是一种自然的情况,你想从一种类型转换到另一种类型。 我认为你应该重构你所拥有的东西,并使买方和供应商成为一个实体。 然后,如果您的行为根据客户是否为买方或供应商而有所不同,我会将其解压缩为可以设置或添加到客户端的单独对象。 I am wondering why you even have the two different sub classes if it is a natural situation that you want to change from o ...
  • DateTime? _maxRecordedDate = _ctx.Usage_Snapshots.Where(s => s.server_id == server_id).Max(d => d.reported_on); DateTime? _maxRecordedDate = _ctx.Usage_Snapshots.Where(s => s.server_id == server_id).Max(d => d.reported_on);
  • 使用Column属性装饰Name属性,与使用Linq2SQL的任何其他类型相同。 It seems, I've found a way how to solve my problem. Today I've found nice series of post named "Advanced Domain Model queries using Linq". Author presents his way to support more convenient(pretty) Lambda syntax to ...
  • @Jason的答案对于手动调整每个类很有用。 要修改所有生成的类以使用相同的基类,.dbml文件中的属性可以手动编辑(在VS2008中没有UI)。 将EntityBase xml属性添加到 xml元素中,其值是基类的全名。 ... 它由LINQ to Entity Base项目使用。 @Jason's answer is useful for manu ...
  • 通过使用委托,您强制它使用LINQ-to-Objects,这就是内存不足的原因。 你需要做的是建立一个Expression 。 同样,使用属性是不好的做法,因为这不是LINQ-to-SQL支持的唯一模型; 最好查看dataContext.Mapping.GetMetaType(entityType)以获取主键。 如果您有4.0,则以下内容应该有效: var entityType = typeof(User); var metaType = dataContext.Mapping.GetMetaType(en ...
  • 看起来你已经将一个TempQuestion的属性类型从int更改为某个东西而忘记更改相应的表列的类型。 Solved it... Its was due to multiple not-disposed dataContext's

相关文章

更多

最新问答

更多
  • h2元素推动其他h2和div。(h2 element pushing other h2 and div down. two divs, two headers, and they're wrapped within a parent div)
  • 创建一个功能(Create a function)
  • 我投了份简历,是电脑编程方面的学徒,面试时说要培训三个月,前面
  • PDO语句不显示获取的结果(PDOstatement not displaying fetched results)
  • Qt冻结循环的原因?(Qt freezing cause of the loop?)
  • TableView重复youtube-api结果(TableView Repeating youtube-api result)
  • 如何使用自由职业者帐户登录我的php网站?(How can I login into my php website using freelancer account? [closed])
  • SQL Server 2014版本支持的最大数据库数(Maximum number of databases supported by SQL Server 2014 editions)
  • 我如何获得DynamicJasper 3.1.2(或更高版本)的Maven仓库?(How do I get the maven repository for DynamicJasper 3.1.2 (or higher)?)
  • 以编程方式创建UITableView(Creating a UITableView Programmatically)
  • 如何打破按钮上的生命周期循环(How to break do-while loop on button)
  • C#使用EF访问MVC上的部分类的自定义属性(C# access custom attributes of a partial class on MVC with EF)
  • 如何获得facebook app的publish_stream权限?(How to get publish_stream permissions for facebook app?)
  • 如何防止调用冗余函数的postgres视图(how to prevent postgres views calling redundant functions)
  • Sql Server在欧洲获取当前日期时间(Sql Server get current date time in Europe)
  • 设置kotlin扩展名(Setting a kotlin extension)
  • 如何并排放置两个元件?(How to position two elements side by side?)
  • 如何在vim中启用python3?(How to enable python3 in vim?)
  • 在MySQL和/或多列中使用多个表用于Rails应用程序(Using multiple tables in MySQL and/or multiple columns for a Rails application)
  • 如何隐藏谷歌地图上的登录按钮?(How to hide the Sign in button from Google maps?)
  • Mysql左连接旋转90°表(Mysql Left join rotate 90° table)
  • dedecms如何安装?
  • 在哪儿学计算机最好?
  • 学php哪个的书 最好,本人菜鸟
  • 触摸时不要突出显示表格视图行(Do not highlight table view row when touched)
  • 如何覆盖错误堆栈getter(How to override Error stack getter)
  • 带有ImageMagick和许多图像的GIF动画(GIF animation with ImageMagick and many images)
  • USSD INTERFACE - > java web应用程序通信(USSD INTERFACE -> java web app communication)
  • 电脑高中毕业学习去哪里培训
  • 正则表达式验证SMTP响应(Regex to validate SMTP Responses)