{"id":7,"date":"2007-10-04T13:56:00","date_gmt":"2007-10-04T18:56:00","guid":{"rendered":"http:\/\/blogs.devhorizon.com\/reza\/?p=7"},"modified":"2007-11-21T11:17:35","modified_gmt":"2007-11-21T16:17:35","slug":"getting-user-login-from-the-peopleeditor-via-code","status":"publish","type":"post","link":"https:\/\/blogs.devhorizon.com\/reza\/2007\/10\/04\/getting-user-login-from-the-peopleeditor-via-code\/","title":{"rendered":"Getting user login from the PeopleEditor via Code"},"content":{"rendered":"<p>Assuming you have a people editor control defined like below:<\/p>\n<p> &lt;wssawc:PeopleEditor AllowEmpty=&#8221;false&#8221;\u00a0 ID=&#8221;myPeopleEditorControl&#8221; runat=server SelectionSet=&#8221;<strong>User<\/strong>&#8221; MaximumEntities=&#8221;1&#8243; MultiSelect=&#8221;<strong>false<\/strong>&#8221; AllowTypeIn=&#8221;false&#8221; Width=&#8217;500px&#8217; \/&gt;<\/p>\n<p> The following code sample will get you the currently logged on user&#8217;s login from the PeopleEditor control:<\/p>\n<p> \u00a0 ArrayList peEntities = myPeopleEditorControl.Entities;<br \/>\n \u00a0 PickerEntity pickEn = (PickerEntity)peEntities[0];<br \/>\n \u00a0 stringLogIn = pickEn.Key;<\/p>\n<p> This comes handy when you want to create an SPUser context out of the entities kept in the PeopleEditor control. For example:<\/p>\n<p> \u00a0private SPUser GetUser(string logIn)<\/p>\n<p> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 {<br \/>\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 SPUser user = this.workflowProperties.Web.SiteUsers[logIn];<br \/>\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 return user;<br \/>\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 }<\/p>\n<p> Don&#8217;t forget Required Field Validation on your people editor control if you want the code not to break on you.<\/p>\n<p> <img loading=\"lazy\" decoding=\"async\" width=\"1\" src=\"\/\/blogs.devhorizon.com\/aggbug.aspx?PostID=510\" height=\"1\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Assuming you have a people editor control defined like below: &lt;wssawc:PeopleEditor AllowEmpty=&#8221;false&#8221;\u00a0 ID=&#8221;myPeopleEditorControl&#8221; runat=server SelectionSet=&#8221;User&#8221; MaximumEntities=&#8221;1&#8243; MultiSelect=&#8221;false&#8221; AllowTypeIn=&#8221;false&#8221; Width=&#8217;500px&#8217; \/&gt; The following code sample will get you the currently logged on user&#8217;s login from the PeopleEditor control: \u00a0 ArrayList peEntities = myPeopleEditorControl.Entities; \u00a0 PickerEntity pickEn = (PickerEntity)peEntities[0]; \u00a0 stringLogIn = pickEn.Key; This comes handy when [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[43],"tags":[3],"class_list":["post-7","post","type-post","status-publish","format-standard","hentry","category-moss-2007","tag-moss-2007"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Getting user login from the PeopleEditor via Code - Reza Alirezaei&#039;s Blog %<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/blogs.devhorizon.com\/reza\/2007\/10\/04\/getting-user-login-from-the-peopleeditor-via-code\/\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Reza Alirezaei\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/blogs.devhorizon.com\\\/reza\\\/2007\\\/10\\\/04\\\/getting-user-login-from-the-peopleeditor-via-code\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/blogs.devhorizon.com\\\/reza\\\/2007\\\/10\\\/04\\\/getting-user-login-from-the-peopleeditor-via-code\\\/\"},\"author\":{\"name\":\"Reza Alirezaei\",\"@id\":\"https:\\\/\\\/blogs.devhorizon.com\\\/reza\\\/#\\\/schema\\\/person\\\/cdbb24d283697a65951cb4a14e474938\"},\"headline\":\"Getting user login from the PeopleEditor via Code\",\"datePublished\":\"2007-10-04T18:56:00+00:00\",\"dateModified\":\"2007-11-21T16:17:35+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/blogs.devhorizon.com\\\/reza\\\/2007\\\/10\\\/04\\\/getting-user-login-from-the-peopleeditor-via-code\\\/\"},\"wordCount\":123,\"commentCount\":1,\"keywords\":[\"MOSS 2007\"],\"articleSection\":[\"MOSS 2007\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/blogs.devhorizon.com\\\/reza\\\/2007\\\/10\\\/04\\\/getting-user-login-from-the-peopleeditor-via-code\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/blogs.devhorizon.com\\\/reza\\\/2007\\\/10\\\/04\\\/getting-user-login-from-the-peopleeditor-via-code\\\/\",\"url\":\"https:\\\/\\\/blogs.devhorizon.com\\\/reza\\\/2007\\\/10\\\/04\\\/getting-user-login-from-the-peopleeditor-via-code\\\/\",\"name\":\"Getting user login from the PeopleEditor via Code - Reza Alirezaei's Blog %\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/blogs.devhorizon.com\\\/reza\\\/#website\"},\"datePublished\":\"2007-10-04T18:56:00+00:00\",\"dateModified\":\"2007-11-21T16:17:35+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/blogs.devhorizon.com\\\/reza\\\/#\\\/schema\\\/person\\\/cdbb24d283697a65951cb4a14e474938\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/blogs.devhorizon.com\\\/reza\\\/2007\\\/10\\\/04\\\/getting-user-login-from-the-peopleeditor-via-code\\\/\"]}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/blogs.devhorizon.com\\\/reza\\\/#website\",\"url\":\"https:\\\/\\\/blogs.devhorizon.com\\\/reza\\\/\",\"name\":\"Reza Alirezaei's Blog\",\"description\":\"Blogging from the field!\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/blogs.devhorizon.com\\\/reza\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/blogs.devhorizon.com\\\/reza\\\/#\\\/schema\\\/person\\\/cdbb24d283697a65951cb4a14e474938\",\"name\":\"Reza Alirezaei\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/3ba940d84e0ecb909e62e93df4c56daf0395c7e53c914467ab2ee73124a7d7b6?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/3ba940d84e0ecb909e62e93df4c56daf0395c7e53c914467ab2ee73124a7d7b6?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/3ba940d84e0ecb909e62e93df4c56daf0395c7e53c914467ab2ee73124a7d7b6?s=96&d=mm&r=g\",\"caption\":\"Reza Alirezaei\"},\"url\":\"https:\\\/\\\/blogs.devhorizon.com\\\/reza\\\/author\\\/rezaa\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Getting user login from the PeopleEditor via Code - Reza Alirezaei's Blog %","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/blogs.devhorizon.com\/reza\/2007\/10\/04\/getting-user-login-from-the-peopleeditor-via-code\/","twitter_misc":{"Written by":"Reza Alirezaei","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/blogs.devhorizon.com\/reza\/2007\/10\/04\/getting-user-login-from-the-peopleeditor-via-code\/#article","isPartOf":{"@id":"https:\/\/blogs.devhorizon.com\/reza\/2007\/10\/04\/getting-user-login-from-the-peopleeditor-via-code\/"},"author":{"name":"Reza Alirezaei","@id":"https:\/\/blogs.devhorizon.com\/reza\/#\/schema\/person\/cdbb24d283697a65951cb4a14e474938"},"headline":"Getting user login from the PeopleEditor via Code","datePublished":"2007-10-04T18:56:00+00:00","dateModified":"2007-11-21T16:17:35+00:00","mainEntityOfPage":{"@id":"https:\/\/blogs.devhorizon.com\/reza\/2007\/10\/04\/getting-user-login-from-the-peopleeditor-via-code\/"},"wordCount":123,"commentCount":1,"keywords":["MOSS 2007"],"articleSection":["MOSS 2007"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/blogs.devhorizon.com\/reza\/2007\/10\/04\/getting-user-login-from-the-peopleeditor-via-code\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/blogs.devhorizon.com\/reza\/2007\/10\/04\/getting-user-login-from-the-peopleeditor-via-code\/","url":"https:\/\/blogs.devhorizon.com\/reza\/2007\/10\/04\/getting-user-login-from-the-peopleeditor-via-code\/","name":"Getting user login from the PeopleEditor via Code - Reza Alirezaei's Blog %","isPartOf":{"@id":"https:\/\/blogs.devhorizon.com\/reza\/#website"},"datePublished":"2007-10-04T18:56:00+00:00","dateModified":"2007-11-21T16:17:35+00:00","author":{"@id":"https:\/\/blogs.devhorizon.com\/reza\/#\/schema\/person\/cdbb24d283697a65951cb4a14e474938"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/blogs.devhorizon.com\/reza\/2007\/10\/04\/getting-user-login-from-the-peopleeditor-via-code\/"]}]},{"@type":"WebSite","@id":"https:\/\/blogs.devhorizon.com\/reza\/#website","url":"https:\/\/blogs.devhorizon.com\/reza\/","name":"Reza Alirezaei's Blog","description":"Blogging from the field!","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/blogs.devhorizon.com\/reza\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/blogs.devhorizon.com\/reza\/#\/schema\/person\/cdbb24d283697a65951cb4a14e474938","name":"Reza Alirezaei","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/3ba940d84e0ecb909e62e93df4c56daf0395c7e53c914467ab2ee73124a7d7b6?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/3ba940d84e0ecb909e62e93df4c56daf0395c7e53c914467ab2ee73124a7d7b6?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/3ba940d84e0ecb909e62e93df4c56daf0395c7e53c914467ab2ee73124a7d7b6?s=96&d=mm&r=g","caption":"Reza Alirezaei"},"url":"https:\/\/blogs.devhorizon.com\/reza\/author\/rezaa\/"}]}},"_links":{"self":[{"href":"https:\/\/blogs.devhorizon.com\/reza\/wp-json\/wp\/v2\/posts\/7","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.devhorizon.com\/reza\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.devhorizon.com\/reza\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.devhorizon.com\/reza\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.devhorizon.com\/reza\/wp-json\/wp\/v2\/comments?post=7"}],"version-history":[{"count":0,"href":"https:\/\/blogs.devhorizon.com\/reza\/wp-json\/wp\/v2\/posts\/7\/revisions"}],"wp:attachment":[{"href":"https:\/\/blogs.devhorizon.com\/reza\/wp-json\/wp\/v2\/media?parent=7"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.devhorizon.com\/reza\/wp-json\/wp\/v2\/categories?post=7"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.devhorizon.com\/reza\/wp-json\/wp\/v2\/tags?post=7"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}