English 中文(简体)
如何在方案上记录分享点
原标题:How to programmatically login on sharepoint

我想向用户介绍一个用户名、密码和标识的网络方法。 我如何从方案上将这些参数输入网站,以便在网页方法完成后,网页再载,用户现在“被打脚”。 我想避免使用Login作为纸张控制,因为我要以麻风气向网上发送这些参数,并以这种方式将用户登录。

最佳回答

我在Windows Form Application上使用了这一方法,并做了以下工作:

请注意,在本法典中你必须写明的间谍名称和密码:

private bool loginSharePoint()
    {
        lbLoginStatus.Text = "Logging in Sharepoint server";

        bool isValid = false;

        //validating Sharepoint login
        string spUsername = tbSharePointUsername.Text;

        string spPassword = tbSharePointPassword.Text;


        pc = new PrincipalContext(ContextType.Domain, spUsername.Split( \ )[0]);

        pbLogin.PerformStep();
        // validate the credentials
        isValid = pc.ValidateCredentials(spUsername.Split( \ )[1], spPassword);
        if (isValid)
        {
            pbLogin.PerformStep();

            pbLogin.PerformStep();
            site = new SPSite(tbSharePointUrl.Text);

            pbLogin.PerformStep();
            web = site.OpenWeb();

            pbLogin.PerformStep();
            if (web.DoesUserHavePermissions(spUsername, SPBasePermissions.Open))
                isValid = true;
            else
                isValid = false;
        }


        return isValid;
    }
问题回答

暂无回答




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Transaction handling with TransactionScope

I am implementing Transaction using TransactionScope with the help this MSDN article http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx I just want to confirm that is ...

System.Web.Mvc.Controller Initialize

i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...

Microsoft.Contracts namespace

For what it is necessary Microsoft.Contracts namespace in asp.net? I mean, in what cases I could write using Microsoft.Contracts;?

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签