the singularity of being and nothingness
CFSharePoint: Adding Groups…and Users to Them :)
Enough of lists! The last few posts, I’ve been dealing with the same old boring lists, and I’ve grown tired of that. So today, I want to show a quick example of how to use some of the Users and Groups web services to handle user and group management.
So let’s say I have a brand new user. They have astounding technical skills, so I decide that I want to add her to a special group of users that I’ll call “Super Users”. The only issue, however, is that this group does not exist. So to check all the items off my list and call it a day, I need to:
- Create the “Super Users” group;
- Add Maria to this group; and
- Add some missing user information about Maria
The first thing we need is to create the new SharePoint group. This is easy:
<cfsharepoint action="addgroup" domain="localhost" userName="un" password="pwd" name="theresult" wsdl="http://localhost/_vti_bin/UserGroup.asmx?wsdl" params="#{groupName="Super Users", ownerIdentifier="mycomp\joel", ownerType="user", defaultUserLoginName="mycomp\joel", description="A group of really cool, really powerful users :)" }#" />
Regarding the info being passed, there’s nothing really to speak of. However, you should notice that the method “addgroup” is not listed in the CF9 reference as being supported by the <cfsharepoint> tag (and believe me, a quick test reveals that they mean it!). Fortunately, this isn’t a big deal. While the method may not be directly supported by CF9, you can always pass the full path to the correct WSDL file with the “wsdl” attribute in the <cfsharepoint> tag and it will work just fine 🙂 (BTW, the correct WSDL file can be determined by looking at the MSDN reference for the web service method in question).
Ok, so we’ve created our group. Now we need to add Maria.
<cfsharepoint action="addusertogroup" domain="localhost" userName="un" password="pwd" name="theresult" params="#{groupName="Super Users", userName="Maria", userLoginName="mycomp\Maria", userEmail="marai@singularityconcepts.com", userNotes="She's pretty funny!" }#" />
Again, super simple. In the params, you simply pass the name of the group and some basic information about the person being added.
That’s about it, nothing to it. However, let’s assume for the sake of this post dragging on just a bit longer that during the process of adding Maria to the Super Users group we made a mistake–let’s say we mispelled her e-mail address. No problem, simply invoke the “UpdateUserInfo” and pass the right information:
<cfsharepoint action="updateuserinfo" domain="localhost" userName="un" password="pwd" name="theresult" wsdl="http://localhost/_vti_bin/UserGroup.asmx?wsdl" params="#{userName="Maria", userLoginName="mycomp\Maria", userEmail="maria@singularityconcepts.com", userNotes="She's pretty funny!" }#" />
As with the “AddGroup” method, the “UpdateUserInfo” is not currently supported by the <cfsharepoint> tag. However, as before, accessing the method is as easy as passing the path to the WSDL file in the “wsdl” attribute.
So these examples have been pretty simple. However, they continue to show how easy CF9 makes interacting with SharePoint–even unsupported methods are handled with great ease. Yep, I’ve very happy 🙂
Print article | This entry was posted by existdissolve on August 4, 2009 at 8:59 am, and is filed under ColdFusion, SharePoint. Follow any responses to this post through RSS 2.0. You can leave a response or trackback from your own site. |
about -1917 years ago
Hi There,
I’ve downloaded CF9 here and been trying to use cfsharepoint tag for the last 2 days. unfortunately, it has been an unsuccessfull attempt for me to use that new tag.
Below is what I’ve done, please point me if I’m wrong.
I have my CF9 server in server A and sharepoint server in server B. Then I setup a virtual directory on Server A to point to the _vti_bin folder from Server B then I use this tag to test the cfsharepoint tag.
<cfsharepoint action="getlistcollection" domain="Server A IP" userName="domain\username" password="password" name="result"/> then I go #result.resultflag# for the output. but then it gives me this error.
Unable to read WSDL from URL: Error: 500 Internal Server Error.
Can you please help me with the solution please? Thank you in advance.
Mike
about -1917 years ago
Hi Mike–
I guess the first question I would ask is if you can access the WSDL file at all. You should be able to access it through a browser simply by navigating to the correct address.
EX: http://localhost/_vti_bin/UserGroup.asmx?wsdl
If you receive the 500 error when browsing to this, then it would appear that you either have a configuration issue or the wrong URL. I would start by trying to access the WSDL from the browser, and then go from there.
about -1917 years ago
Hi,
I’m getting a different message now. I can read the WSDL file now if I view it straight away by navigating to the address.
http://server A/_vti_bin/UserGroup.asmx?wsdl.
However, if I use cfsharepoint tag, it will never work. I’m getting Unable to read WSDL from URL: 401. Unauthorized.
I must’ve misconfigured the web service setup. Do you have a link or can you tell me the step on how to access the _vti_bin folder? I assume the _vti_bin folder is from the Sharepoint server right?
Thanks in advance again.
Mike
about -1917 years ago
Hi,
I’m getting a different message now. I can read the WSDL file now if I view it straight away by navigating to the address.
http://server A/_vti_bin/UserGroup.asmx?wsdl.
However, if I use cfsharepoint tag, it will never work. I’m getting Unable to read WSDL from URL: 401. Unauthorized.
I must’ve misconfigured the web service setup. Do you have a link or can you tell me the step on how to access the _vti_bin folder? I assume the _vti_bin folder is from the Sharepoint server right?
Thanks in advance again.
Mike
about -1917 years ago
Ah, I think I see what the issue might be. In your authorization attributes, you have:
domain="Server A IP"
userName="domain\username"
password="password"
The "domain" is not the IP, at least from what I understand. Rather, use the "domain" from the username.
So instead of userName="domain\username", split those apart so that domain="domain" and username="username".
Let me know if that works out for you.
about -1917 years ago
I had the same problem as Mike. It turns out that <cfsharepoint> only works if the server is using Basic Authentication. In IIS Manager, I edited the Directory Security for the _vti_bin folder and checked the Basic Authentication box. Sadly, this means the password used is sent in clear text.
about -1917 years ago
Ed–
Yes, that’s right, and the docs for <cfsharepoint> indicate this.
about -1917 years ago
Yes in ColdFusion9 we support only Basic Authentication for cfsharepoint integration.
Thanks,
Asha
Adobe ColdFusion Team.
about -1917 years ago
I am also having issues with a webservice in CF9. I am browsing to the wsdl file directly to try to get close to the problem. The URL localhost/mycfc.cfc?wsdl works fine in CF8. If I change my settings to use CF9, then try to access the same URL, I get the same 500 error that Mike was getting.
about -1917 years ago
Hey Ryan–
What’s the full URL of the file you are trying to access?