Email address from SharePoint 'friendly name'

  • 21 January 2008
  • 2 replies
  • 4 views

Badge +7

See for pictures: http://blog.mgallen.com/?p=30


I've been wondering what the best way forward is on a little problem i've come across. I want to use some document library metadata, 'Document Approver' (which is a SharePoint user) as the input to a K2 [blackpearl] Mail Event.


The sharepoint document library seems to display a sharepoint friendly name of e.g. 'Martin G Allen' when what I actually need is e.g. mgallen@domain.com - this is fine, as this is how SharePoint intended the data to look... but here's the problem... how do I get at the email address from this friendly name in K2... how does one construct a SmartObject to achieve this or is it better done another way.


Any help greatfully received


Martin


 


2 replies

Badge +1

Martin


 I have the same issue - was there an easy solution ?


 David

Badge +7

Hi David,


Yes... there is a relatively simple solution. It involves making the use of the SharePoint ServiceObject instance.


You can construct a SmartObject in such a way that one of its methods can be pointed to a service object instance. I can't remember the name of the SharePoint ServiceObject method in question at this time, but I think it was 'GetUser'.


This method can take as an input parameter 'DOMAINUser' and return you whatever you like, it is like an AD search.. You can retrieve, FirstName, LastName, email address etc.


This is the easiest way of doing it, but bear in mind my blog post that explains the difficulty involved with using the SharePoint service object. http://blog.mgallen.com/?p=166 


It will explain that K2 [blackpearl] references SharePoint instances by a GUID. If you attempt to deploy to another machine (using MSBUILD) with a different instance of SharePoint... you need to hack the .res files to modify the GUID inside them.


Martin

Reply