准备:①先在‘任务’列表中新建一个视图,例:WPView。
②在SharePoint Designer中找到‘任务’列表并打开其中的‘WPView.aspx’。
方法:找到从"<Query>"开头到"</Query>"结尾的中间一段代码,用
下面的代码替换即可。(替换“<>”为“<>”)
“按我的用户组”视图:
<Query>
<Where>
<Membership Type="CurrentUserGroups">
<FieldRef Name="AssignedTo"/>
</Membership>
</Where>
<GroupBy Collapse="FALSE">
<FieldRef Name="AssignedTo"/>
</GroupBy>
<OrderBy>
<FieldRef Name="AssignedTo"/>
<FieldRef Name="Status"/>
<FieldRef Name="Priority"/>
</OrderBy>
</Query>
<Where>
<Membership Type="CurrentUserGroups">
<FieldRef Name="AssignedTo"/>
</Membership>
</Where>
<GroupBy Collapse="FALSE">
<FieldRef Name="AssignedTo"/>
</GroupBy>
<OrderBy>
<FieldRef Name="AssignedTo"/>
<FieldRef Name="Status"/>
<FieldRef Name="Priority"/>
</OrderBy>
</Query>
“我的任务”视图:
<Query>
<Where>
<Eq>
<FieldRef Name="AssignedTo"/>
<Value Type="Integer">
<UserID/>
</Value>
</Eq>
</Where>
<OrderBy>
<FieldRef Name="Status"/>
<FieldRef Name="Priority"/>
</OrderBy>
</Query>
<Where>
<Eq>
<FieldRef Name="AssignedTo"/>
<Value Type="Integer">
<UserID/>
</Value>
</Eq>
</Where>
<OrderBy>
<FieldRef Name="Status"/>
<FieldRef Name="Priority"/>
</OrderBy>
</Query>
“我&我的用户组的所有未完成任务”视图:
<Where>
<And>
<Or>
<Membership Type="CurrentUserGroups">
<FieldRef Name="AssignedTo"/>
</Membership>
<Eq>
<FieldRef Name="AssignedTo"/>
<Value Type="Integer">
<UserID/>
</Value>
</Eq>
</Or>
<Eq>
<FieldRef Name='Completed'/>
<Value Type='Text'>0</Value> <!--100=已完成,0=未完成-->
</Eq>
</And>
</Where>
<And>
<Or>
<Membership Type="CurrentUserGroups">
<FieldRef Name="AssignedTo"/>
</Membership>
<Eq>
<FieldRef Name="AssignedTo"/>
<Value Type="Integer">
<UserID/>
</Value>
</Eq>
</Or>
<Eq>
<FieldRef Name='Completed'/>
<Value Type='Text'>0</Value> <!--100=已完成,0=未完成-->
</Eq>
</And>
</Where>