Email address from SharePoint 'friendly name'

Last post 04-09-2008, 11:40 AM by mgallen. 2 replies.
Sort Posts: Previous Next
  •  01-21-2008, 9:14 AM 21267

    • mgallen is not online. Last active: 12-19-2008, 7:17 AM mgallen
    • Top 25 Contributor
    • Joined on 01-15-2008
    • Melksham, Wiltshire, United Kingdom
    • Posts 123
    • Points 394

    Email address from SharePoint 'friendly name'

    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

     


    Martin Allen

    Visit my blog: SpittingCAML blog
  •  04-09-2008, 10:50 AM 23066 in reply to 21267

    Re: Email address from SharePoint 'friendly name'

    Martin

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

     David

  •  04-09-2008, 11:40 AM 23073 in reply to 23066

    • mgallen is not online. Last active: 12-19-2008, 7:17 AM mgallen
    • Top 25 Contributor
    • Joined on 01-15-2008
    • Melksham, Wiltshire, United Kingdom
    • Posts 123
    • Points 394

    Re: Email address from SharePoint 'friendly name'

    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 'DOMAIN\User' 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


    Martin Allen

    Visit my blog: SpittingCAML blog
    Filed under: , ,
View as RSS news feed in XML