Wednesday, November 28, 2012

Project Server 2010 - Send email to members of a group

Managing groups from code behind is very easy in Sharepoint. If you want to send email to every user of Sharepoint group, that is also very easy; you just get SPGroup by its name, loop through members of that group and and fetch their emails or some other property directly.

But, if you try doing that with Project Server, you'll find that it is a hard nut to crack. Project Server groups do not have same properties as Sharepoint groups do. So, if you want to access different user properties, you can use web services of Project Server SDK. They are not easy to configure and documentation is also confusing. I have described an easier way of configuring PSI functions in this post, with some examples.

Only way of accessing group data is directly accessing Project Server database and you don't need to use web services at all. This is an easy way.

If you need to fetch emails of all users of a Project Server group, you can do it with this SQL:

SELECT [WRES_EMAIL]
FROM [ProjectServer_Published].[dbo].[MSP_RESOURCES]
WHERE RES_SECURITY_GUID IN (
    SELECT [WRES_GUID] 
    FROM [ProjectServer_Published].[dbo].[MSP_WEB_SECURITY_GROUP_MEMBERS]
    WHERE WSEC_GRP_GUID = (
        SELECT [WSEC_GRP_GUID]
        FROM [ProjectServer_Published].[dbo].[MSP_WEB_SECURITY_GROUPS]
        WHERE WSEC_GRP_NAME = 'GroupName'))

This query will return all emails of users of a group named "GroupName".

Thursday, November 8, 2012

Sharepoint 2013 - "Sign in as different user" missing

In the (old) Sharepoint 2010 there was a very useful feature in user's menu: "Sign in a Different User". Even though, business users have no need for this feature, it is essential for developers and testers.




That feature isn't there anymore in the Sharepoint 2013.

 


But, it can be added, as Nick Grattan showed in his blog.


Locate the file \15\TEMPLATE\CONTROLTEMPLATES\Welcome.ascx and open in a text editor.
Add the following element before the existing element with the id of “ID_RequestAccess”:



<SharePoint:MenuItemTemplate runat="server" ID="ID_LoginAsDifferentUser"
Text="<%$Resources:wss,personalactions_loginasdifferentuser%>"
Description="<%$Resources:wss,personalactions_loginasdifferentuserdescription%>"
MenuGroupId="100"
Sequence="100"
UseShortId="true"
/>
 

Save the file.
Now, the menu item shall be displayed: