get current login user in sharepoint desginer - code-behind RRS feed

  • Question

  • my situations require authentitication, or current user. then can do further control which pages can he read.

    is it SPD 2010 has this functions? how can code(if( currentUser =="abc"){// go this site;})

    as i know sharepoint desginer can only work with html or js.  

    Anyone has idea?

    Friday, December 23, 2011 11:54 AM


  • Hi,

    In SharePoint Designer, use LOGON_USER server variable to get the curretn login user. For including this follow these steps

    1- Add <ParameterBinding Name="LogonUser" Location="ServerVariable(LOGON_USER)"/> inside <ParameterBindings></ParameterBindings> as

        <ParameterBinding Name="ListID" Location="None" DefaultValue="EF49CFE7-C6C4-42D6-8FCB-B10D6CDC0A35"/>
        <ParameterBinding Name="dvt_apos" Location="Postback;Connection"/>
        <ParameterBinding Name="UserID" Location="CAMLVariable" DefaultValue="CurrentUserName"/>
        <ParameterBinding Name="Today" Location="CAMLVariable" DefaultValue="CurrentDate"/>
        <ParameterBinding Name="LogonUser" Location="ServerVariable(LOGON_USER)"/>

    2- Add <xsl:param name="LogonUser"/> before template  <xsl:template match="/">

    3- You can get the value of current login as  <xsl:value-of select="$LogonUser"/> inside your template

    You can also follow article @ http://blogs.msdn.com/b/joshuag/archive/2008/06/03/getting-the-current-user-name-or-id-in-sharepoint-using-sharepoint-designer-no-code.aspx

    My Blog
    Twitter @jaggavivek
    • Edited by Vivek Jagga Friday, December 23, 2011 12:34 PM
    • Marked as answer by Entan Ming Thursday, December 29, 2011 9:51 AM
    Friday, December 23, 2011 12:33 PM

All replies