Atlanta .NET Regular Guys

Community Blog for two guys in Atlanta that focus on Microsoft and Community.

Quick About

This is the community blog for Brendon Schwartz and Matt Ranlett.  If you want to see their technical posts visit http://www.sharepointguys.com

Back To DevCow

Recent Posts

Tags

Email Notifications

    Archives

    October 2006 - Posts

    Fiddler and SoapExceptions

    Jim Wooley posted about how he informed me that this great HTTP analyzer tool called Fiddler existed.  This let me look into my code's exceptions to figure out what was happening.  He posted about the existance of the tool and how it's a great thing.  I thought I should post my specific example, what it showed me and what I learned from it.

    I'm writing some code that access the SharePoint 2007 web services.  My code is trying to call the AddUserToGroup web method located at http://localhost/_vti_bin/UserGroup.asmx.  The proxy method call requires two string parameters - user LoginName and Group Name.  (Actually the method requires 5 parameters, but these 2 are the only ones verified against the system).  I was passing a valid AD user login name and a valid group name, but my call to the web service was getting a Microsoft.SharePoint.SoapServer.SoapServerException.  The problem was that I couldn't find the actual details of what the error really was.  The Exception.InnerException was null and the Exception.Message just said that a SoapServerException occurred.  The stack trace was useless as it just showed me the line of the reference class that was experiencing the exception.  How the heck could I tell what was actually causing the exception?

    Fiddler to the rescue.  I opened that bad boy up and got the following feedback:

    The SOAP envelope contains an error string which told me that my username did not exist.  Now, how do I get that value in my code so I can react to it?

    Once I knew what I was looking for, I implemented the following code to log a descriptive error to the eventlog.  If I can, I cast the general exception message to a SoapException and get the SoapException.Detail.InnerText. 

    // create an event log source called Extranet if it doesn't exist
    if (!EventLog.SourceExists("Extranet"))
    {
    EventLog.CreateEventSource("Extranet", "Application");
    } 
    
    // create an eventlog object to handle writing errors to the event log
    EventLog log = new EventLog("Application");
    log.Source = "Extranet" 
    
    // build the event log error message
    StringBuilder errorMessage = new StringBuilder("Error: ");
    errorMessage.Append(ex.GetType().Name + Environment.NewLine); 
    
    // try to cast the exception to a soap exception so we can get useful info
    try
    {
    SoapException sexp = (SoapException)(ex);
    errorMessage.Append("Soap Envelope error details: " + Environment.NewLine);
    errorMessage.Append(sexp.Detail.InnerText);
    }
    catch (Exception)
    { 
    // just log the original details
    }
    // continue appending details to the exception log message
    errorMessage.Append("User details - SharePoint Group Names: " + Environment.NewLine);
    errorMessage.Append(userDetails.groupNames + Environment.NewLine);
    errorMessage.Append("User details - User Name: " + Environment.NewLine);
    errorMessage.Append(userDetails.userName + Environment.NewLine);
    errorMessage.Append("User details - User LoginName: " + Environment.NewLine);
    errorMessage.Append(userDetails.userLoginName + Environment.NewLine);
    errorMessage.Append("Stack Trace: " + Environment.NewLine);
    errorMessage.Append(ex.StackTrace);
    errorMessage.Append("Message: " + Environment.NewLine);
    errorMessage.Append(ex.Message); 
    
    // write the error to the event log
    log.WriteEntry(errorMessage.ToString());
    
     
    Reviewing documents - assign a handy keyboard shortcut

    Dan and I are working together to tech review an upcoming SharePoint 2007 book.  We were asked at the last minute and have extremely short deadlines, so we're looking for ways to eek out dribs and drabs of speed during our review process.

    To that end, I present you with a quick tutorial on assigning keyboard shortcuts in Microsoft Word 2003 (equally applicable to other Office programs).

    If you're doing some heavy editing and reviewing, you'll want to turn on change tracking and you'll want to be able to insert comments.  Typically, to insert a comment in a document you can do one of three things:

    1.  Highlight some text, hit Insert,  select Comment and type in your comment

    Insert...Comment

     

    2.  Turn on the Reviewing toolbar, highlight some text, hit the Insert Comment button on the toolbar

    Insert Comment button

     

    3.  Assign a keyboard shortcut, highlight some text, hit the keyboard shortcut.

    To assign a new keyboard shortcut, follow these steps:

    1. Right-click the toolbar and select Customize
    2. Hit the keyboard button on the Commands tab
    3. Find Insert...InsertNewComment.  Press your new hotkey combo.  I picked CTRL+SHFT+Z because I can easily hit this with the hand not on the mouse.

    Now you too can insert a comment via a keyboard shortcut.  This just feels faster to me.

    Paul Wilson is an MVP in my book

    It is funny how much Matt and I think a like.  I recently read, in many places across the web, that Paul Wilson was not awarded an MVP for this year.  When I read the post I thought the same thing Matt did, which is Paul will always be an MVP to us.  For those who don't remember Paul was the first developer MVP that Matt and I wrote about in our old series "Tales from the Trenches".  Wow does that bring back some memories.  Paul still contributes a lot to the community with speaking at Code Camps and User Groups so I am sure we will see him as an MVP again one day.

    C# global namespace alias

    In class we were working with a web service.  Since this was a simple class exercise, all the web service did was sleep for 3 seconds.  When we added the web reference to the web service into our class library (so we could call said web service) we got a declaration that looked like this:

    WebService.Service srvc = new global::WebService.Service()

    What the heck was that "global::" bit there for?  It was actually in the Intellisense. 

    I found this in MSDN2 - http://msdn2.microsoft.com/en-us/library/c3ay4x3d.aspx

    Basically you're preventing confusion in the namespaces.  Fair enough.  Cool that Intellisense detected that this keyword was needed, but I'm not sure why my tiny listtle test app needed this since I wasn't using any similar namespace.  The namespace of the project I was using was actually "AdvancedWebParts".  To my knowledge, I wasn't aliasing away my namespace.  I'll have to look back at the code.

    SharePoint 2007 permissions and web parts

    Is this a bug or do I not understand something?

    Office SharePoint Server 2007 Beta 2 (not TR):

    I have 2 users - 1 in the Admin group and 1 in the Visitor group.

    I have a Links List.  The web part security says that members of the visitor group have no read access for this list (because I changed it).  I log in as admin and everything looks cool

    I can see my list

    I log in as visitor and see web part but get access denied in the box.

    I see the list's presence, but I get access denied in the contents

    Shouldn't this get security trimmed away?  How do I secure entire webparts, ex a custom web part that doesn't back to a list?  Custom code, right?  How do I do that for web parts that DO back to lists?  Seems busted to me.

    What about Anonymous access?  How's that work for *secured* web parts?

    Learn about the Extended Club Starter Kit tonight at the VB.NET group

    I just wanted to make sure everyone knew that we are having a meeting for the VB.NET Study Group tonight.  I (Brendon) will be presenting on the Extended Club Starter Kit changes that I made for the ASP.NET sample.  Come out and join us if you can.

    The mystery pillar of the .NET Framework 3.0

    Ask a developer in the know about the major parts of the .NET Framework 3.0 and they'll be able to tell you that it consists of the WPF, WCF, and WF pillars.  Frequently they'll forget that the .NET Framework 3.0 is actually a 4 legged table, not a tripod.  The oft-forgotten child is the Windows CardSpace pillar.

    CardSpace is an open initiative designed to assist with the challange of proving identity in a digital world.

    I can't do as good a job of explaining exactly what CardSpace is as David Chappelle, so here is his article in MSDN.

     

    CardSpace digitial identity manager
    Web Parts != Web Parts

    SharePoint 2007 web parts are NOT exactly the same as ASP.Net 2.0 web parts.  Actually, SharePoint 2007 web parts inherit from the ASP.Net 2.0 web part class.  More on this later

    MindSharp SharePoint Summit in Atlanta, Day 2

    My timing in joining Intellient is impeccable.  The first week that I am with them just happens to be the same week that Todd Bleeker and Bill English from MindSharp are hosting their SharePoint Summit in Atlanta.  So Intellinet ponied up a big chunk of change to get me some training during my first week on the job.  Of course, I'll immediately be able to put some of this knowledge to work when I go to my first billable task next week.

    So the Summit seems very well done so far.  We have covered a quick intro to Windows SharePoint Services 2007 and now we've started working on some real SharePoint dev topics.  We've looked at a lot of UI customization and some minor functionality tweaking.  We're getting into the heavier lifting in the coming modules.

    The Summit is actually split into two 5 day courses, an Admin course (taught by Bill English) and a Dev course (taught by Todd Bleeker).  Several other MindSharp employees wander around and assist the main presenter when memory lapses might otherwise cause us to miss some tidbit of information.  So much information is flying around these rooms that I'm not worried that I'll not learn enough, I'm worried that I'll forget too much!

    Atlanta tastes GRRREAT!

    I had a good time today wandering around Atlantic Station with my friends and my lovely wife eating samples of food from nearly 100 of Atlanta's best restaurants.  All proceeds from the event went to the Atlanta Food Bank.

    Posted: 10-15-2006 2:22 PM by Matt Ranlett | with no comments
    Filed under:
    My new toys

    I recently received a belated birthday gift - a gift card to Microcenter.  Thanks Greg and Mike!  I went out this afternoon and picked up these little toys with my newfound riches.

    PSP Battery Pack from Joytechan external battery pack to extent the battery life of my trusty Sony PSP.

    I also snapped up a discounted copy of Lumies, a Tetris-like puzzle game which was voted one of the best games for the PSP when it came out.

    Lumies screenshot
    Posted: 10-10-2006 10:43 AM by Matt Ranlett | with no comments
    Filed under:
    Wintellect gets even stronger

    WintellectWintellect has been on a tear locally, hiring up some of Atlanta's best talent.  First Justin Smith got hired, then it was Todd Fine.  Next up was Greg Young, Steven Porter, and now Brendon Schwartz.  Brendon's first day with Wintellect was yesterday and he's already hard at work proving his mettle.

    Congrats Brendon - I'm sure you'll be a huge asset to that organization.

    Posted: 10-10-2006 5:52 AM by Matt Ranlett | with 4 comment(s)
    Filed under:
    The question has been answered - apparently I am the woman

    Brendon and I both interviewed at Intellinet.  Part of the application process is taking a personality test.  The test is offered online and supposedly delves deep into your psyche by asking you to rank sets of words.  Anyway - Brendon and I naturally compared test results and we found the outcome pretty hysterical.

    According to the test, I talk to much, am disorganized and impulsive, emotional, optimistic and I exaggerate.  I'm apparently a woman!  Brendon, on the other hand is apparently impatient, insensitive, bad listener, blunt and overbearing.  He's apparently a man.  This clears up the mystery about the two of us when we share dinner at some of those wings places after user group meetings.

    Apparently I'm the wife.  I'm a little disappointed in that.

     

    Man in a dress
    Posted: 10-10-2006 5:40 AM by Matt Ranlett | with 8 comment(s)
    Filed under: ,
    Walking for charity

    This weekend was fairly busy - filled with visits from friends, meals out, movies, and a 5K walk for charity.

    Highlights include:

    In Alpharetta - eat at Pure Taqueria.  Be sure to arrive early however, as we got there at 5:30 and had to wait 30 minutes outside before getting a table.  The food was good, evocative of Taqueria Del Sol, and trust me, that is a good thing.

    Watched The Illusionist with Edward Norton and Paul Giamatti this weekend.  It actually reminded me of some of the better heist movies I've seen recently and I give it 4.5 hunched programmers on my crazy rating scale.

    Spent Sunday walking a 5K for Ty's Trot Toward a Cure.  We walked around the GA Tech campus while helping to support the United Mitochondrial Disease Foundation.

    I also managed to rebuild a computer for some friends.  It's amazing how much better a 2 year old computer is than a 4 year old computer.  PS - my home PC is a 4 year old computer.  My friends got quite the upgrade, from a 900Mhz, 128Mb, 20 Gb machine to a 2.66Ghz, 256Mb, 100Gb machine.  Good stuff for a free machine!

    Posted: 10-09-2006 7:24 AM by Matt Ranlett | with no comments
    Filed under:
    It's that time again

    MSDN Event

    Time to get ready for Glen Gordon and the next MSDN Event.  At next month's event (Nov 7) you'll learn about:

    • a new version of Visual Studio - Visual Studio for Database Developers
    • Windows Workflow Foundation
    • Expression Web Designer
    More Posts Next page »