Tuesday, July 24, 2007

The new release of WSS SDK

I was pleased to see some good additions to the WSS SDK in its latest release from 7/13. I am glad that Microsoft took into account a lot of community content and included information that was circulating blogs, CodeCamp sessions and newly released books for some time now. The articles, which explain how to create solutions and the principle of deploying and retracting solutions are much better. Since this is a topic I had to deal with couple of months ago, with almost no good resource of information, I find this new addition to the SDK of great value to developers that are starting with SharePoint.

The additions to "What's New ...", "Technical Articles" and "Visual How Tos" make this a much better learning and reference tool. Check it out!

Dovizhdane!

Monday, July 16, 2007

Tampa Code Camp

One big Thank You to all of you that attended my Tampa Code Camp session "Developer's Introduction to SharePoint". The presentation and the code sample are available for download here : TampaCodeCamp2007.zip. If you have questions related to the sample post a comment to this message.

The code camp was really big. The attendance was well above 300 and probably reaching 400. Keith Kabza and his team from the Tampa Bay .NET User Group did an amazing job organizing the event. The venue was loaded with modern AV and the logistics of the sessions, the lunch and ... the parties was flawless. Simply put, another great Florida code camp.

Dovizhdane!

Wednesday, July 11, 2007

RunWithElevatedPrivileges, watch out for the site context

Soon or later most SharePoint developers use RunWithElevatedPrivileges. We do that either to grant temporary access to files and folders not accessible by the current user or to execute some other action, which requires higher privileges. One thing I constantly forget about that always gets me with an "Access denied" error is when I omit the fact that the SPSite/SPWeb objects are initialized differently for different user contexts. Have a look at this code:

SPSecurity.RunWithElevatedPrivileges(delegate()
{
SPWeb web = SPContext.Current.Web;

// do something that's not allowed for the current user, but it is ok for the elevated user

SPFile file = web.GetFile(restritedFileUrl);

string readProperty = file.Properties["Name"].ToString();
});

Seems like done deal. Not so.... The problem is that the SPWeb object from the current context is initialized using the current user's credentials, so even though we run the code snippet with elevated privileges the actual access to the file is still restricted. To circumvent this we have to create a new SPSite/SPWeb object within the elevated code, where we run in the context of the elevated user. Then we can perform the restricted action. Since the SPSite/SPWeb objects are created explicitly we have to also dispose of them (more about why we need to do this here). The modified working code becomes:

string siteUrl = SPContext.Current.Web.Url;

SPSecurity.RunWithElevatedPrivileges(delegate()
{
SPSite sysSite = new SPSite(siteUrl);
SPWeb sysWeb = sysSite.OpenWeb();

// do something that's not allowed for the current user, but it is OK for the elevated user

SPFile file = sysWeb.GetFile(restritedFileUrl);

string readProperty = file.Properties["Name"].ToString();

sysWeb.Dispose();

sysSite.Dispose();

});

Access granted...

Dovizhdane!

Monday, July 02, 2007

A busy month of learning and creating

June turned out to be a very busy month. I started with a weekend in Orlando for the INETA summit, where I learned quite a bit of how user groups are functioning and contributing to the developer community. There were representatives from groups small and big, from all over north America. This meeting definitely inspired me of some activities that can spice up the live of the SCDNUG.

Another huge event that came the week after was TechEd held in the Orlando convention center. This was the first time a attended such big developer event and I was really blown away by the amount of presentations, topics, self paced training options (and entertainment). I tried to stay loyal to SharePoint, but also wanted to expand in the upcoming new technologies from the software giant. There were many excellent sessions on LINQ, WCF, WPF and Silverlight. The overall opinion of our group was that LINQ is one of the biggest improvements in the .Net languages, along with the other improvements coming in Orcas. Needless to say, I am eager to get my hands wet. TDD was all over the place with interactive sessions, BOF and informal conversations in the VisuaStudio booth. IMHO the high point was delivered by Doug Seven who electrified the audience with an impressionable presentation and intro demo. After five days driving back and forth to Orlando and hours of sessions for five days, I closed the show attending a demo showing how to use AJAX.NET in SharePoint. Great plan, still hard to implement in real world applications.

After this I thought I couldn't take it anymore and I don't want to talk about technology at least for a week. Well I was not so lucky, exploring the materials from the show, I found couple of promotional vouchers for certifications. Among them was one from the office launch event. I decided that with the least amount of work l can pass "70-541 Microsoft Windows SharePoint Services 3.0 - Application Development". So I took the extremely sketchy Preparation Guide and went through the list for about a day or two. Surprisingly I was able to get all pieces from the the SDK, MSDN and blogs, but I would not recommend this for somebody starting with SharePoint. The issue is that the knowledge is very fragmented and without a book or CBT to put a structure in all the bits, mastering SharePoint can be frustrating. Nevertheless I just got the word that I passed it. Who knows I may get back on the certification track again, even though I have mixed feelings about certifications and their value.

Now I am getting ready for my second code camp session in Tampa. I am planning to give a SharePoint introduction for developers emphasizing on the whole picture, not only how to create a web part or how to deploy it, but how to get going with the the first simple SharePoint project. Code camps are great volunteer events from developers for developers. If you are interested in attending Tampa code camp you can register at http://www.tampacodecamp.com/

Right after this on 07/18 is the SCDNUG meeting. We'll have a must see presentation by INETA guest speaker Brian Noyes, who is Microsoft Regional Director for the Mid-Atlantic region. The topic is "Connecting Applications with WCF". To register click here: https://www.clicktoattend.com/invitation.aspx?code=119083. See you there!

Dovizhdane!