Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

First I want to point out that I am very new to SharePoint. I have recently been hired as a SharePoint administrator, developer and content maintainer. Fortunately my new employer is willing to train me and realizes that it will take some time for me to reach the "expert" level with all this new (to me) technology. I bring nearly thirty years of development experience, primarily with Microsoft products but others as well so learning new things has just been part of my life since I can remember.

Okay, with that out of the way here is the scenario. I want to document our SharePoint 2010 implementation in a repeatable way that stores the resultant information to a persistent data store (my preference would be SQL Server). This way I can compare what it is this week to what it was last week and so on. I plan to start fairly small but eventually want to include some detailed information. Particularly about the security structure because we have a real hodgepodge of security with some set in AD and other set in SharePoint. Permissions applied to users at all levels as well as both AD and SharePoint groups. My goal with this is to both get a useful product and to help me learn the underpinnings of SharePoint.

I started writing some PowerShell scripts but quickly realized that I was writing code using the Microsoft.SharePoint assemblies and all of the logic structures. I started to wonder if all of this could be done in C# so I started investigating what it would take to be able to fire up Visual Studio and write a C# program to gather all of the information I want and write it to a complex database structure.

All of this is what lead me to these questions:

  • Can I do everything I want in C# using the SharePoint assemblies to get to the information I need?
  • Is the full functionality of the SharePoint PowerShell cmdlets available in the SharePoint assemblies?
  • Can I write to a SQL Server DB from a PowerShell script?
  • Which would you use?

All insight will be welcomed.

I realize that these are very general and open ended questions and if this is not the appropriate place for them then please let me know where I should pose them and I will happily move this post.

Thanks,
Doug

share|improve this question
add comment

2 Answers 2

up vote 1 down vote accepted

Can I do everything I want in C# using the SharePoint assemblies to get to the information I need? Yes, the powershell api and the c# api are almost identical, with the exception of language specifics

Is the full functionality of the SharePoint PowerShell cmdlets available in the SharePoint assemblies? Yes

Can I write to a SQL Server DB from a PowerShell script? See this. If you want to write to sql I would suggest using c#

Which would you use? I program in both when talking to sharepoint. If it is something I will need to run fast on the spot, I use powershell. If it is something an admin will need to run, I use powershell. If it is something I need to have better control over, I use c#. I prefer c#, but that is because it is my native language. However, powershell can be very powerfull, such as using pipe to write short and simple scripts.

share|improve this answer
1  
Thanks for the response. Sounds like we are of the same mindset. C# is definitely my language of choice and has been for some time. I will certainly not set PowerShell scripting aside as I have already seen the power and value of it. –  dscarr Dec 20 '12 at 18:33
    
Yeah, I had the same experience 7 months ago. Came into SharePoint with nothing but 2 years of .net and c++. –  thantos Dec 20 '12 at 18:35
add comment

Rather than try to document everything, it would be better to start out with what it is that you are specifically concerned about. If it is who is making changes to security then the Audit Log reports already show that. If you are trying to see what permissions a user has, the 'Check Permissions' Ribbon button already does that. If you want to do a full breakdown of site security, there are third party tools that do that as well. Worried about CPU and disk space usage or database growth? SCOM already shows that. And so forth.

Basically, don't reinvent the wheel as odds are very good that the information you are trying to get to is already available in some form.

share|improve this answer
    
Thanks for the post Dave. I am also an avid supporter of the "don't reinvent the wheel" philosophy and most likely will be pushing for the purchase of a third party tool at some point. However, one of my main objectives in this exercise is to try to learn how all of these pieces fit together. For me, there is no better way than to walk my way through the object model examining the various properties and methods and resulting data. But again, I do appreciate the input. –  dscarr Dec 21 '12 at 13:32
    
If you happen to know of any tools that can examine the entire security structure of my SharePoint web application, I would truly appreciate hearing about your experiences with them. –  dscarr Dec 21 '12 at 13:32
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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