Demosthenes
asked on
c# SharePoint 2010
The code below works when I point it to two of my three SharePoint servers. My third server I get 401 error. Any ideas anyone ?
private void button3_Click(object sender, EventArgs e)
{
label3.Text = "";
try
{
treeview1.Nodes.Clear();
ClientContext clientContext = new ClientContext(comboBox1.Text);
Web oWebsite = clientContext.Web;
ListCollection collList = oWebsite.Lists;
clientContext.Load(collList);
clientContext.ExecuteQuery();
foreach (SP.List oList in collList)
{
TreeNode listnode = new TreeNode();
listnode.Text = oList.Title;
treeview1.Nodes.Add(listnode);
}
}
catch (Exception ex)
{ label3.Text = ex.Message; }
}
Are you using Kerberos?
ASKER
Yes
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Through reading these articles I installed Fiddler, and watched my transaction. Something about the hostname looked odd to me so I used IP address instead. Code now works. The hostname of course works when you put it in a browser, but not in my code.
"http://sp1" is a browsable sharepoint server, but this line doesn't like it:
ClientContext clientContext = new ClientContext(comboBox1.Te xt);
I am having my server team put in a nice DNS entry for the server.
"http://sp1" is a browsable sharepoint server, but this line doesn't like it:
ClientContext clientContext = new ClientContext(comboBox1.Te
I am having my server team put in a nice DNS entry for the server.