Forum Discussion
Sharepoint online management module reference broken in azure
Hi Juan,
What i was trying to do was get the site collections list in the tenant and details, I did not get any object in C# to access the tenant object , I could see there is a third party dll in nuget which i could use to get the tenant object but i wanted to stick to microsoft.
If you can share some example or some article that would be good to know for future knowoledge.
Thanks,
KJ
- May 30, 2017Here you are :-) https://gallery.technet.microsoft.com/How-to-get-all-the-tenant-2999c21b?redir=0 as you can see, you just need to use CSOM dlls and no third party ones
- KJSMay 31, 2017Brass Contributor
Hi,
Thanks for the sample, May be i did not put my question correctly here
What i was initially trying was to get the list of all the site collection from csom in C# web job, So was not able to find the tenant object in C# to resolve that what i did
My intial approch
from c# web job call powershell object and get the site collection list using " Get-SPOSite " but as i deployed the job in azure it was not able to find reference for "Microsoft.Online.SharePoint.PowerShell" and it threw exception.
Roadblock
Was not able to get tenant object in C# initially and later on tried getting powershell but the reference was not resolved "Microsoft.Online.SharePoint.PowerShell" in azure web job code.
Final approch
I moved the compelte code in powershell to get site collection list and write back to sharepoint list and deployed as runbook.
Kindly correct me if i am wrong but is there a way in c# to get list of all site collections in a farm.
Thanks,
- Peter McDonaldMay 31, 2017Iron Contributor
In addition to porting the code into c# you can call powershell from the c# application using system.management.automation class.
https://msdn.microsoft.com/en-us/library/system.management.automation.powershell(v=vs.85).aspx