Unauthorized error in Lists.asmx while adding attachments RRS feed

  • Question

  • Hi,

    I'm receiving the below error, when i tried to add the attachments using Lists.asmx.

    The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from the server was 'Negotiate,NTLM'.

    Code Used:

    string fileName = System.IO.Path.GetFileName(filePath);
    byte[] byteArray = System.IO.File.ReadAllBytes(filePath);ServiceReference1.ListsSoapClient sc = new ServiceReference1.ListsSoapClient();
    sc.ClientCredentials.Windows.ClientCredential = new System.Net.NetworkCredential("username", "password$", "domain");
    sc.AddAttachment(ListNameComboBox.SelectedValue.ToString(), listItem.Id.ToString(), fileName, byteArray);

    Anandhan.S Remember to 'mark or propose as answer' or 'vote as helpful' as appropriate.

    Friday, May 10, 2013 12:35 PM