Get the SharePoint groups in Infopath 2010 and SharePoint 2010 by current user without any code

本文详细介绍了如何使用InfoPath创建一个表单,用于检查用户是否属于某些SharePoint组,并显示相应的部分。通过设置数据源和自定义表单,避免了使用C#代码实现的安全考量。

We have a lot of requirements to check if user is in some SharePoint group then show some section in the InfoPath form.

But we don't like to use custom C# code to implement it since some security reason, here is the infopath form result which get all the SharePoint group for current use:

 

This article will show you step by step for how to do it.

1. First create a list to test it, needn't  to add any cloumn since we only need to use its custom infopath form

2. Open the list, click the list tab, click "Customize Form"

3. In the opened InfoPath form, add data source for UserGroup.asmx (we need to use function GetGroupCollectionFromUser):


a. Click on Manage “Data Connections” which is on the bottom preview of “Field” pane.
b.  Click on “Add” Button.
c.  Check on “Receive Data” which belongs to “Create new connection to”.
d.  Check the “Soap Web Service”.
e.  Put this URL “http://servername/_vti_bin/userGroup.asmx?WSDL” in text bar.
f.  Click on “Next” Button.
g.  Select “GetGroupCollectionFromUser” from the list.
h.  Click on “Next” Button.
i.  Click on “Set Sample Value” Button.
j.  Provide the value (domain\username, that is only a example data).
k.  Click on “Next” Button
l.  Click on Next Button
m.  Check on “Store a copy of the data in the form template”.
n.  Do not tick on “Automatically retrieve data when the form is opened”.

 

4. Add data source for UserProfileService.asmx (we need to use function GetUserProfileByName)

 a. In the “Data Connection” window click on “Add” Button.
b. Check on “Receive Data” which belongs to “Create new connection to”.
c. Check the “Soap Web Service”.
d. Put this URL “http://servername/_vti_bin/ UserProfileService.asmx? WSDL” in text bar.
e. Click on “Next” Button.
f. Select “GetUserProfileByName” from the list.
g. Click on “Next” Button.
h. Click on “Next” Button by leaving “Set Value” of “account Name”.
j. Check the “Store a copy of the data in the form template”.
k. Do not  check on “Automatically retrieve data when the form is opened”.
l. Click on “Close” Button in “Data Connection” window pane.
m. Go to “File” tab which is on top preview. 

5. Publish the InfoPath(click the quick publish button)

 

6.  Update the schema of the InfoPath form:

   a. Click the file-> publish -> "Export Source Files"

   b. Select one folder(e.g. D:\SharePoint\Candidates) for it

   c. Open the GetGroupCollectionFromUser1.xsd(around 24 kb), close the SharePoint designer before updating this file.

   d. Identify this line.

<s:import namespace="http://www.w3.org/2001/XMLSchema"></s:import>


   e. Paste the follow xml blow the above line 

<s:complexType name="GetGroupCollectionFromUserType">
		<s:sequence>
			<s:element minOccurs="0" maxOccurs="1" name="userLoginName" type="s:string"/>
			<s:element minOccurs="0" maxOccurs="1" name="Groups">
				<s:complexType>
					<s:sequence>
						<s:element maxOccurs="unbounded" name="Group" >
							<s:complexType>
								<s:attribute name="ID" type="s:unsignedShort"></s:attribute>
								<s:attribute name="Name" type="s:string"></s:attribute>
								<s:attribute name="Description" type="s:string"></s:attribute>
								<s:attribute name="OwnerID" type="s:unsignedByte"></s:attribute>
								<s:attribute name="OwnerIsUser" type="s:string"></s:attribute>
							</s:complexType>
						</s:element>
					</s:sequence>
				</s:complexType>
			</s:element>
		</s:sequence>
	</s:complexType>


  f. Search the follow xml 

<s:element name="GetGroupCollectionFromUser">
		<s:complexType>
			<s:sequence>
				<s:element minOccurs="0" maxOccurs="1" name="userLoginName" type="s:string"></s:element>
			</s:sequence>
		</s:complexType>
	</s:element>

  g. And replace it with  

<!--<s:element name="GetGroupCollectionFromUser">
		<s:complexType>
			<s:sequence>
				<s:element minOccurs="0" maxOccurs="1" name="userLoginName" type="s:string"></s:element>
			</s:sequence>
		</s:complexType>
	</s:element>-->
	<s:element name="GetGroupCollectionFromUser" type="tns:GetGroupCollectionFromUserType" />

 h. Save the xsd file and right click "manifest.xsf" select design(it will bring you back to the InfoPath form design UI)

 

7. Query data from UserProfileService.asmx 

a. Click the data tab and click "Form Load" button

b. Click new to crate a new rule, name the rule as QueryUserProfile

c. Click Add for "Run these action" and select "Set a field's value", select the AccountName for the field:

d. Set the value

e. Click Add for "Run these action" and select "Query for data", then selec the GetUserProfileByName for the data connection:

8. Query data from UserGroup.asmx

 a. Click the data tab and click "Form Load" button

 b. Click new to crate a new rule, name the rule as QueryGroup

 

c. Click Add button "Run these action", select "Set a field's value", then select the GetGroupCollectionFromUser->myFields->queryFields-> tns:GetGroupCollectionFromUser->userLoginName for the field:

d. Set the value:


          

 Click every OK after step 11:

e. Click Add button for "Run these actions" again and select "Query for data", and select the GetGroupCollectionFromUser

 

 9. Add a list box to display the SharePoint groups:

     a. Click the Home tab, and click "List Box"

   

   b.  Right click the added list box and select property

   c. Select "Get choices from an external data source"

   d. Select the GetGroupCollectionFromUser as data source

   e. Select the entries, value and display name as below:

 

    10. The last step is click the quick publish button again

 

(1)求职者端(Web 前端) 岗位浏览与搜索: 智能推荐首页:基于 “专业背景 + 求职意向” 推荐匹配岗位(如 “计算机专业硕士” 优先推荐 “高校计算机教师岗”“实验员岗”),展示岗位核心信息(学校名称、岗位名称、薪资范围、截止日期)。 多条件筛选:支持按 “岗位类型(教学岗 / 科研岗 / 行政岗)、学历要求(硕士 / 博士)、地区(华北 / 华东等)、学校层次(985/211 / 双非)” 组合筛选,结果按 “匹配度 / 发布时间 / 薪资” 排序。 岗位详情页:展示 “岗位职责、任职要求、福利待遇、应聘流程、联系人信息”,提供 “收藏岗位、一键投递简历、查看该岗位竞争热度(如‘已有 230 人投递’)” 功能。 个人求职中心: 简历管理:支持创建多版本简历(如 “教学岗专用简历”“科研岗专用简历”),包含 “基本信息、教育经历、科研成果、教学经验、获奖情况” 等模块,支持 PDF 导出和在线编辑。 应聘跟踪:记录 “已投递岗位、简历状态(已接收 / 筛选中 / 面试通知 / 已录用)、截止日期提醒”,对 “3 天内即将截止的岗位” 自动推送提醒。 竞争分析:针对已投递岗位,展示 “求职者学历分布(博士占比 75%)、专业匹配度排名(你的匹配度 85 分,超过 80% 竞争者)”,辅助评估自身竞争力。 (2)高校招聘负责人端(Web 管理端) 岗位管理: 岗位发布:填写 “岗位名称、招聘人数、学历要求、专业方向、岗位职责、薪资范围、应聘方式” 等信息,支持上传 “岗位说明书附件”,设置 “自动截止日期” 和 “简历接收邮箱”。 批量操作:对 “已过期岗位” 进行批量下架,对 “热门岗位(投递量>100)” 设置 “自动置顶”,支持 “岗位信息批量导出(Excel 格式)”。 简历筛选: 智能初筛:系统自动对投递简历进行 “匹配度评分”
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值