views:

332

answers:

1

Hi,

After much wrangling I have a development environment for building sharepoint webparts in c#.

I'm completely new to SP development, so I haven't quite found the various API docs, so I'm hoping someone can help get me started.

Eventually, I want to write a simple web part that allows its user to display different content depending on who the current user is.

What I'd like to do first though is just build a dead simple webpart that will simply print out the current user's details - username, full name and any permissions groups that they have.

Thanks

+2  A: 

SPContext.Current.Web.CurrentUser

Janis Veinbergs
Thank you! I'm actually even newer at this than that though! previously everything I did was in PHP and I could probably happily paste that in and do a few print_r's to find out what I got. I might need a little more handholding just to get going. So far I'm only at "Hello World" by overriding RenderWebPart() :)
MalphasWats
Well you actually deployed your webpart then and that is pretty good so far.Use Visual Studio with intellisense to see available properties for objects.You can also use System.Diagnostics.Debug.WriteLine method to output data. This data can be viewed with program such as DebugView then. But better then is to use Visual Studio debugger to see values of objects etc. You may play around with console application, because with WebPart you must deploy dll etc (if you just use it for playing around purposes)
Janis Veinbergs
Cool, thank you. I was struggling for a minute until I realised I was missing a `using Microsoft.SharePoint`, had `Microsoft.SharePoint.WebPart` though! I got that working, displaying the current name of the user. Thanks
MalphasWats
MSDN is your friend: http://msdn.microsoft.com/en-us/library/ms464984(v=office.14).aspx
Janis Veinbergs
+1 for playing around with console apps to learn
Ryan