Posts

Showing posts from September, 2009

A cool way to use Properties in a SharePoint Web Part

Properties are nothing new in OOP, but something that I stumbled upon not too long ago was a cool thing that you could do with properties. My work was SharePoint web part related, but I imagine that it would work with any customized object that can be called in your page. I needed a way to reuse a webpart that was accessing a single User Profile field so that I could display any field I wished, as many as I wanted just by simply dropping a new custom web part on my page in SPD and simply adding a name/value pair to the HTML. The idea here is to build your web part with a property: public string CustomProperty {   get { return _CustomProperty; }   set { _CustomProperty= value; } } Nothing crazy here but later in the code we check the CustomProperty property for a value and if it's valid, we go and grab the field from the User Profile database and then display it in the web part: <WpNs0:ProfilePropertyPart runat="server...

Get users of AD group for use in SharePoint webpart.

Welcome to my first technical posting. My task here was simple, create a web part that displays the users of an Active Directory OU (Organizational Unit or group basically) which will have been added to a SharePoint site. This is our model internally going forward on how we are managing access to sites within our farm, so basically every site will only have one member... an AD group. This way we can manage (or let someone else manage) access through AD. I won't get into how to create a web part in this post ( you can start here if you like ), but more of the guts of what I used to get what I needed out of .NET in a web part. This is really basic to the rendered output is nothing fancy. Basically I got the site's userlist from the site context, iterated the user list, checked to see if the user was a group, if so, called code to give me the AD users of that group and output the user list. First add a reference to: System.DirectoryServices.AccountManagement; Here's the code: ...

Allow myself to introduce... myself.

Blogspot, here we go! Okay, so I have a MySpace page, facebook, friendster, twitter, Tumblr, and now a blogspot account. The reason for this new blog for me is that I never really had a place to put things about what I learn in my career anywhere. All that other stuff is fun and cool for keeping in the loop about all things viral and fun, but none of them are really places that I could put anything of substance. My goal for this blog is to mainly put things up here that I learn about my chosen profession of web development. I have been a professional developer for about 4 years now, so not too awful long considering I graduate 4 years ago fresh into the industry. I know some things, and not a lot about a lot more, but hopefully, I can help someone following in my footsteps find the answers, in layman's terms to some difficult, and maybe not so difficult programming and web development issues, most of which going forward will probably be about programming web parts in Share Point 20...