1

I am unable to retrieve "secondarycontact" value from Site object. I am using client dll v16.0.4002.1211 against SharePoint 2013. my code is here :

ClientContext context = new ClientContext(siteUrl);
context.Credentials = new NetworkCredential("username", "password");
Site site = context.Site;
context.Load(site, s => s.Owner, s => s.SecondaryContact);
context.ExecuteQuery();
Console.WriteLine(site.Owner.Title);
Console.WriteLine(site.SecondaryContact.Title);

Exception:

Microsoft.SharePoint.Client.ServerException: Field or property "SecondaryContact
" does not exist.
   at Microsoft.SharePoint.Client.ClientRequest.ProcessResponseStream(Stream res
ponseStream)
   at Microsoft.SharePoint.Client.ClientRequest.ProcessResponse()
   at ConsoleApplication.Program.Main(String[] args) in c:\Users\mani-3065\Docum
ents\Visual Studio 2013\Projects\ConsoleApplication\ConsoleApplication\Program.c
s:line 63

In msdn blog its given that Secondary contact property is available for SharePoint 2013. Can anyone help? thanks in advance

1

First fetch the primary administrator using CSOM : Context.Site.Owner

Then use rest api to get sitecollection administrators "https://siteurl/_api/web/siteusers?$filter=IsSiteAdmin%20eq%20true"

Except the site owner remaining all users are secondary site collection administrators

0

You need to install new NuGet package for that in Visual Studio. It's new update for SharePoint CSOM.

Please follow the steps given here.

Hope this is what you want.:)

  • can i use this dll for SharePoint 2013 on-premise? because its given as ''Microsoft.SharePointOnline.CSOM'' – Mani Dharmarajan Feb 16 '16 at 10:42
  • I think YES. Because they have mentioned that in that blog. – Dikesh Gandhi Feb 16 '16 at 10:45
  • I tried using the new package. but the problem persists. Still same exception is thrown – Mani Dharmarajan Feb 16 '16 at 13:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.