如何在InfoPath表单中验证SharePoint Portal中是否存在用户?

时间:2022-11-23 09:31:24

I am creating a form within InfoPath which is to be integrated into a SharePoint 2007 Portal. Within this form there will be a textfield into which a user can enter the Name of a Person.

我正在InfoPath中创建一个表单,该表单将集成到SharePoint 2007门户中。在此表单中,将有一个文本字段,用户可以在其中输入人员姓名。

How can I validate whether this Person exists or not?

如何验证此人是否存在?

Instead of validating the user, is there a way to fill a dropdown List with all usernames of the portal? (which of cause would be users from the Active Directory)

有没有办法用门户网站的所有用户名填充下拉列表? (原因是Active Directory中的用户)

6 个解决方案

#1


1  

I haven't done this specifically, so there may be a better way, but I've been pulling a lot of data out of SharePoint and into an InfoPath Form (deployed to a SharePoint forms library and accessible through SharePoint Forms Service with MOSS Enterprise) and also going the other way using the SharePoint web services - very quick to use, and the person web service is right there.

我没有专门做过这个,所以可能有更好的方法,但我已经从SharePoint中提取了大量数据并转换为InfoPath表单(部署到SharePoint表单库,可通过带有MOSS Enterprise的SharePoint Forms Service访问)并且还使用SharePoint Web服务以另一种方式 - 非常快速地使用,并且人员Web服务就在那里。

#2


1  

Have you tried looking at the Contact Selector (an ActiveX control). Here is a MSDN-article describing how to add it as a control in InfoPath and this one describes how to make it work.

您是否尝试过查看联系人选择器(ActiveX控件)。这是一篇MSDN文章,描述了如何在InfoPath中将其添加为控件,并且这篇文章描述了如何使其工作。

I have been using it in the majority of my infopath projects and it works flawlessly - also for browser-enabled forms.

我一直在我的大多数infopath项目中使用它,它可以完美地工作 - 也适用于支持浏览器的表单。

#3


0  

When doing something similar in an ASP.NET application, I've used the Sharepoint search and searched the "People" Scope for the specific user. You can also search across profile information so you can pull back everyone with a certain Job Title, or in a specific Department.

在ASP.NET应用程序中执行类似操作时,我使用了Sharepoint搜索并搜索特定用户的“People”范围。您还可以搜索个人资料信息,以便您可以撤回具有特定职位的所有人或特定部门。

#4


0  

I don't validate a person's existance, but I do determine a person's full name using their login and SharePoint. You should be able to modify this code for your purposes, it is below. For it to function you need a data connection in your InfoPath document called GetUsersFromSP. Configured as follows:

我不验证一个人的存在,但我确实使用他们的登录和SharePoint确定一个人的全名。您应该可以为您的目的修改此代码,如下所示。要使其正常运行,您需要在InfoPath文档中使用名为GetUsersFromSP的数据连接。配置如下:

  • Location is - http://njintranet2/_vti_bin/usergroup.asmx?WSDL
  • 位置是 - http://njintranet2/_vti_bin/usergroup.asmx?WSDL

  • Operation is – GetUserColectionFromSite (last one on list)
  • 操作是 - GetUserColectionFromSite(列表中的最后一个)

  • Automatically retrieve data when form is opened should be checked.
  • 应检查表单打开时自动检索数据。


string ADName = System.Environment.UserName;
        IXMLDOMDocument3 UserQuery = (IXMLDOMDocument3)thisXDocument.GetDOM("GetUsersFromSP");
        UserQuery.setProperty("SelectionNamespaces",
            "xmlns:dfs=\"http://schemas.microsoft.com/office/infopath/2003/dataFormSolution\" " +
            "xmlns:tns=\"http://schemas.microsoft.com/sharepoint/soap/directory/\"");

        ((WebServiceAdapterObject)thisXDocument.DataAdapters["GetUsersFromSP"]).Query();

        IXMLDOMNode Users = UserQuery.selectSingleNode("//dfs:myFields/dfs:dataFields/tns:GetUserCollectionFromSiteResponse/tns:GetUserCollectionFromSiteResult/tns:GetUserCollectionFromSite/tns:Users");

        foreach (IXMLDOMNode current in Users.selectNodes("tns:User"))
        {
            string Login = current.attributes.getNamedItem("LoginName").text;

            Login = Login.ToUpper();
            if (Login.EndsWith(ADName.ToUpper()))
            {
                thisXDocument.DOM.selectSingleNode("my:root/my:config/my:User").text = current.attributes.getNamedItem("Name").text;
                break;
            }
        }

#5


0  

Use this control: http://blogs.msdn.com/infopath/archive/2007/02/28/using-the-contact-selector-control.aspx

使用此控件:http://blogs.msdn.com/infopath/archive/2007/02/28/using-the-contact-selector-control.aspx

Or if you want to build your own validator, you'll need to query the SharePoint profile database. I'd recommend this over querying AD directly. There's lots of articles online about working with the profile database.

或者,如果要构建自己的验证程序,则需要查询SharePoint配置文件数据库。我建议直接查询AD。网上有很多关于使用个人资料数据库的文章。

#6


0  

Have a look at this Link, it explains how to populate a dropdown with the SharePoint Users

看看此链接,它解释了如何使用SharePoint用户填充下拉列表

http://blueinfopath.blogspot.com/2008/10/how-to-populate-list-with-sharepoint.html

I you want to validate, - Make a textbox - Add a Button, name it ValidateUser - Create a Receive Connection to the ...... - Att Rules to the ValidateUser - Add the textbox to the field AccountName in the Secondary Datasource - Execute the receive connection - Get the value of the field Value with filter Name="PreferredName"

我要验证, - 创建一个文本框 - 添加一个按钮,将其命名为ValidateUser - 创建一个接收连接...... - 将规则添加到ValidateUser - 将文本框添加到辅助数据源中的AccountName字段 - 执行接收连接 - 使用过滤器名称=“PreferredName”获取字段值的值

This work for Infopath Form Services Test it and enter the UserLogin into the textbox and click on the Validate Button

这项工作为Infopath表单服务测试它并在文本框中输入UserLogin并单击验证按钮

Frederik

#1


1  

I haven't done this specifically, so there may be a better way, but I've been pulling a lot of data out of SharePoint and into an InfoPath Form (deployed to a SharePoint forms library and accessible through SharePoint Forms Service with MOSS Enterprise) and also going the other way using the SharePoint web services - very quick to use, and the person web service is right there.

我没有专门做过这个,所以可能有更好的方法,但我已经从SharePoint中提取了大量数据并转换为InfoPath表单(部署到SharePoint表单库,可通过带有MOSS Enterprise的SharePoint Forms Service访问)并且还使用SharePoint Web服务以另一种方式 - 非常快速地使用,并且人员Web服务就在那里。

#2


1  

Have you tried looking at the Contact Selector (an ActiveX control). Here is a MSDN-article describing how to add it as a control in InfoPath and this one describes how to make it work.

您是否尝试过查看联系人选择器(ActiveX控件)。这是一篇MSDN文章,描述了如何在InfoPath中将其添加为控件,并且这篇文章描述了如何使其工作。

I have been using it in the majority of my infopath projects and it works flawlessly - also for browser-enabled forms.

我一直在我的大多数infopath项目中使用它,它可以完美地工作 - 也适用于支持浏览器的表单。

#3


0  

When doing something similar in an ASP.NET application, I've used the Sharepoint search and searched the "People" Scope for the specific user. You can also search across profile information so you can pull back everyone with a certain Job Title, or in a specific Department.

在ASP.NET应用程序中执行类似操作时,我使用了Sharepoint搜索并搜索特定用户的“People”范围。您还可以搜索个人资料信息,以便您可以撤回具有特定职位的所有人或特定部门。

#4


0  

I don't validate a person's existance, but I do determine a person's full name using their login and SharePoint. You should be able to modify this code for your purposes, it is below. For it to function you need a data connection in your InfoPath document called GetUsersFromSP. Configured as follows:

我不验证一个人的存在,但我确实使用他们的登录和SharePoint确定一个人的全名。您应该可以为您的目的修改此代码,如下所示。要使其正常运行,您需要在InfoPath文档中使用名为GetUsersFromSP的数据连接。配置如下:

  • Location is - http://njintranet2/_vti_bin/usergroup.asmx?WSDL
  • 位置是 - http://njintranet2/_vti_bin/usergroup.asmx?WSDL

  • Operation is – GetUserColectionFromSite (last one on list)
  • 操作是 - GetUserColectionFromSite(列表中的最后一个)

  • Automatically retrieve data when form is opened should be checked.
  • 应检查表单打开时自动检索数据。


string ADName = System.Environment.UserName;
        IXMLDOMDocument3 UserQuery = (IXMLDOMDocument3)thisXDocument.GetDOM("GetUsersFromSP");
        UserQuery.setProperty("SelectionNamespaces",
            "xmlns:dfs=\"http://schemas.microsoft.com/office/infopath/2003/dataFormSolution\" " +
            "xmlns:tns=\"http://schemas.microsoft.com/sharepoint/soap/directory/\"");

        ((WebServiceAdapterObject)thisXDocument.DataAdapters["GetUsersFromSP"]).Query();

        IXMLDOMNode Users = UserQuery.selectSingleNode("//dfs:myFields/dfs:dataFields/tns:GetUserCollectionFromSiteResponse/tns:GetUserCollectionFromSiteResult/tns:GetUserCollectionFromSite/tns:Users");

        foreach (IXMLDOMNode current in Users.selectNodes("tns:User"))
        {
            string Login = current.attributes.getNamedItem("LoginName").text;

            Login = Login.ToUpper();
            if (Login.EndsWith(ADName.ToUpper()))
            {
                thisXDocument.DOM.selectSingleNode("my:root/my:config/my:User").text = current.attributes.getNamedItem("Name").text;
                break;
            }
        }

#5


0  

Use this control: http://blogs.msdn.com/infopath/archive/2007/02/28/using-the-contact-selector-control.aspx

使用此控件:http://blogs.msdn.com/infopath/archive/2007/02/28/using-the-contact-selector-control.aspx

Or if you want to build your own validator, you'll need to query the SharePoint profile database. I'd recommend this over querying AD directly. There's lots of articles online about working with the profile database.

或者,如果要构建自己的验证程序,则需要查询SharePoint配置文件数据库。我建议直接查询AD。网上有很多关于使用个人资料数据库的文章。

#6


0  

Have a look at this Link, it explains how to populate a dropdown with the SharePoint Users

看看此链接,它解释了如何使用SharePoint用户填充下拉列表

http://blueinfopath.blogspot.com/2008/10/how-to-populate-list-with-sharepoint.html

I you want to validate, - Make a textbox - Add a Button, name it ValidateUser - Create a Receive Connection to the ...... - Att Rules to the ValidateUser - Add the textbox to the field AccountName in the Secondary Datasource - Execute the receive connection - Get the value of the field Value with filter Name="PreferredName"

我要验证, - 创建一个文本框 - 添加一个按钮,将其命名为ValidateUser - 创建一个接收连接...... - 将规则添加到ValidateUser - 将文本框添加到辅助数据源中的AccountName字段 - 执行接收连接 - 使用过滤器名称=“PreferredName”获取字段值的值

This work for Infopath Form Services Test it and enter the UserLogin into the textbox and click on the Validate Button

这项工作为Infopath表单服务测试它并在文本框中输入UserLogin并单击验证按钮

Frederik