locked
How can I login SharePoint in .NET application? RRS feed

  • Question

  • Hi all, When I use Domain/Local Administrator A/C to run folloing code (Wins Server 08), it's work.

    try
    {
        SPSite xxx = new SPSite("XXX");
     // Create, Update, Delete SharePoint Publishing Site, Page etc.
    
    }
    
    ... SKIP
    
    
    


    But when I user "August" A/C (Member of Domain Administrator, Built in Administrator), I got the unauthorized exception.

    Could you please advise me how can I try?

    For example, Is "Network Confridential" can help me to login SharePoint as Administrator A/C to preform Publishing Page Create/Update actipn etc.?

    If yes, would you please kindly provide sample code?

    Moreover... what permission should I grant for "August" A/C if I use this A/C instead of "Administrator " A/C?

    Many thanks for your attention. ^^
    .NET Beginner 3.5
    Monday, July 13, 2009 5:35 PM

Answers

  • You  must probably register August in a Sharepoint group like <your web site> owners : go to your site settings-users and permissions-people and groups to do it.


    Serge Luca; blog: http://www.redwood.be
    Monday, July 13, 2009 6:22 PM
  • Make sure that "august" has required permissions to create/update the page also if you do not want to give user specfic permission use the elevated privileges

    SPSecurity.RunWithElevatedPrivileges(delegate()
    {
    Monday, July 13, 2009 6:31 PM

All replies

  • You  must probably register August in a Sharepoint group like <your web site> owners : go to your site settings-users and permissions-people and groups to do it.


    Serge Luca; blog: http://www.redwood.be
    Monday, July 13, 2009 6:22 PM
  • Make sure that "august" has required permissions to create/update the page also if you do not want to give user specfic permission use the elevated privileges

    SPSecurity.RunWithElevatedPrivileges(delegate()
    {
    Monday, July 13, 2009 6:31 PM
  • Oh.......... I get it ~ ^o^

    Thank you very much ~
    .NET Beginner 3.5
    Tuesday, July 14, 2009 4:25 AM