从列表中的"SharePoint用户"字段中获取用户名 [英] Get username from SharePoint User field in List

查看:283
本文介绍了从列表中的"SharePoint用户"字段中获取用户名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个在Visual Studio中开发的自定义共享点工作流.该工作流针对具有自定义内容类型的文档库运行.内容类型包括用户查找字段(所有者").

I have a custom sharepoint workflow that I'm developing in Visual Studio. The workflow is running against a document library which has a custom content type connected to it. The content type includes a user lookup field ("owner").

我试图让我的工作流将任务分配给所有者"查找字段.但是,我只能获取用户的显示名称,而不是帐户用户名.

I'm trying to have my workflow assign a task to the "owner" lookup field. However, I've only been able to get the display name for the user, not the account username.

任何人都可以帮忙吗?

推荐答案

请参阅此您的代码应该是这样

SPUser spUser=GetSPUser(splistItem,"Owner");
String sUserName=(spUser!=null)?spUser.UserName:null;

这篇关于从列表中的"SharePoint用户"字段中获取用户名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆