SharePoint获取当前用户属性
我有一个页面需要检索登录用户的部门。理想情况下,我希望能够通过 JavaScript SOAP CAML 查询来完成此操作。我有用户的 ID(我假设它兼作 GUID),因此检索与 ID 匹配的行似乎是一个简单的问题。
我正在考虑在 SOAP 中使用“GetUserProfileByIndex”或“GetUserProfileByGuid”函数,但我似乎找不到任何可靠的文档或使用它们的合适示例。我希望在 JavaScript 中做这样的事情 - (这不起作用):
var userId = 194;
"<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'> \
<soapenv:Body> \
<GetUserProfileByIndex xmlns='http://microsoft.com/webservices/SharePointPortalServer/UserProfileService'> \
<index>userId</index> \
</GetUserProfileByIndex > \
</soapenv:Body> \
</soapenv:Envelope>";
I have a page that needs to retrieve the department for the logged-in user. Ideally I'd like to be able to do it through a JavaScript SOAP CAML query. I have the user's id (which I'm assuming doubles as the GUID), so it seems like a simple matter of retrieving the row that matches the ID.
I'm looking into using the 'GetUserProfileByIndex' or 'GetUserProfileByGuid' function in SOAP, but I can't seem to find any solid documentation or decent examples using them. I'm hoping to do something like this in JavaScript - (which isn't working):
var userId = 194;
"<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'> \
<soapenv:Body> \
<GetUserProfileByIndex xmlns='http://microsoft.com/webservices/SharePointPortalServer/UserProfileService'> \
<index>userId</index> \
</GetUserProfileByIndex > \
</soapenv:Body> \
</soapenv:Envelope>";
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我建议您查看名为 SPServices 的 SharePoint 2007 和 2010 的 jQuery 库。 $().SPServices.SPGetCurrentUser 可以检索高效部门中的4行代码:
I recommend you check out the jQuery Library for SharePoint 2007 and 2010 called SPServices. $().SPServices.SPGetCurrentUser can retrieve the Department in an effecient 4 lines of code:
我从未回答过自己的问题,但我设法想出了一个简单的解决方案。以下是我的处理方法
总体而言,这里是 SOAP 调用和 CAML 查询
I've never answered my own question, but I managed to come up with a simple solution. Here is how I went about it
Overall, here is the SOAP call and CAML query
您可能应该使用
GetUserProfileByName
,网站集 ID 不能用于查找用户配置文件存储中的任何内容。http://amitkumarmca04.blogspot.com/2008 /07/how-access-sharepoint-moss-user-profile.html
You should probably use
GetUserProfileByName
, site collection ids can't be used to lookup anything in the user profile store.http://amitkumarmca04.blogspot.com/2008/07/how-access-sharepoint-moss-user-profile.html