A blog about SharePoint, Project Server and other Microsoft technologies.

Thursday, January 17, 2013

Project Server 2010 - Get group members emails

In one of my previous posts, I showed you how can you get email addresses of all members of a Project Server group using SQL query.

But, SQL query isn't practical if you want to use it in code behind, nor does Microsoft advise accessing project Servers Published database from code behind through SQL queries. It is always better to use PSI functions.This is the code for accessing user emails using PSI functions:

publicstaticbool GetMembersEmails(Guid
projectUid, stringpGroupName)

{

var logService = newLogService();

var sessionService = newPSSessionService()

{

HostName = "serverName", // your PWA host name

SiteName = "pwa"// your PWA site name

};

// we need this user for LoginContext (it can be read from app settings)