简体   繁体   English

如何获取SharePoint列表项作者的电子邮件地址?

[英]How do I get the email address of the author of a SharePoint list item?

As title says, I have access to the current listitem - and it's easy enough to get the author/created by name - but how do I retrieve the e-mail address of the author in C# from the object model? 正如标题所说,我可以访问当前的列表项 - 并且很容易通过名称获取作者/创建 - 但是如何从对象模型中检索C#中作者的电子邮件地址?

Thanks. 谢谢。

You can get the SPUser from a SPFieldUserValue object: 您可以从SPFieldUserValue对象获取SPUser

SPFieldUserValue userValue = 
    new SPFieldUserValue(web, item[SPBuiltInFieldId.Author].ToString());
SPUser user = userValue.User;
string email = user.Email;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何获取传入的电子邮件地址-Sharepoint? - How to get the incoming email address -Sharepoint? SharePoint中。 如何获得列表项的“新”标志? - Sharepoint. How can I get the “New” flag of a list item? 如何在Sharepoint 2010中以编程方式获取视图列表 - How do I get a list of views back programatically in Sharepoint 2010 如何向包含破折号的地址发送电子邮件? - How do I send an email to an address with a dash in it? 如何在SharePoint 2007中通过C#测试查找列表项,如果缺少,将其添加? - How do I test for a lookup list item, and add it if it is missing, in SharePoint 2007 via C#? 如何在SharePoint中覆盖新列表项形式的“确定/取消”按钮? - How do I override the OK/Cancel button of new list item form in SharePoint? 我如何获得电子邮件发件人地址 - How Can I Get The Email Sender Address 仅当item.Email字段中有数据时,如何才能使WebGrid显示电子邮件链接? - How Do I Get WebGrid To Display Email Link Only If There's Data In The item.Email Field? 如何在 c# 中获取 discord 命令的作者 - How do I get the author of a discord command in c# 如何使用 .this[]/indexer 访问 SharePoint 列表项的字段值? - How do you access field values with .this[]/indexer for a SharePoint List Item?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM