Eric’s adventures in Sharepoint, technology, and life.
Email icon Home icon
  • Portal redesign

    Posted on May 29th, 2009 Eric No comments

    As I wait for some workshops to close so I can finish the final pieces of the Revamped Employee Training template, I’m shifting gears and redesigning the top level portal for our Sharepoint environment. This redesign is moving from an SPS 2003 subsite based structure to a “web 2.0″ feel.

    I’m moving all the old content into a wiki and updating it. We’ll also be utilizing a blog to push out information to our users and have a discussion board where the administrators will moderate and answer questions from our user base in an informal setting.

    All in all I’m excited about the redesign as benign as it is. Not looking forward to updating tons of old content though. Internal Sharepoint community will be win and hopefully get more people excited about it.

    Post to Twitter Post to Plurk Plurk This Post Post to Yahoo Buzz Buzz This Post Post to Delicious Delicious Post to Digg Digg This Post Stumble This Post

  • Salute to our troops

    Posted on May 25th, 2009 Eric No comments

    I wanted to take a minute and give a salute to all our nations military personnel, past, present and future. It takes a special person to dedicate their life to service of their country, and without these people, we might not enjoy the liberties that we do.

    On behalf of all Americans home and abroad, we say thank you, stay safe, and come home soon.

    Post to Twitter Post to Plurk Plurk This Post Post to Yahoo Buzz Buzz This Post Post to Delicious Delicious Post to Digg Digg This Post Stumble This Post

  • Feedburner up and running

    Posted on May 19th, 2009 Eric No comments

    Just a quick note, I’ve got feedburner hooked up and running on my blog. If you’d like to subscribe just click the box in the upper right corner and add me to your RSS blog roll. Or you can add me with the following URL: http://feeds2.feedburner.com/EricsSharepointAdventures. Thanks for reading!

    Post to Twitter Post to Plurk Plurk This Post Post to Yahoo Buzz Buzz This Post Post to Delicious Delicious Post to Digg Digg This Post Stumble This Post

  • Using Query String Parameters and Surveys pt2

    Posted on May 14th, 2009 Eric No comments

    In part 1, I showed how to pass a query string parameter to a text or number field in a survey. In part 2, I’ll show how to pass it to a look up field. This was utilized in our Employee Training modifications. The look up list for courses can get quite long and have the potential to be named the same, so we wanted to take the guess work out for the registrants.

    To set a query string on a look up list, perform the all the same steps as in part 1, but do not paste that code into PlaceHolderMain. There is a different script to use. Paste the below code into the PlaceHoldermain area, replacing the Field name and parameter names with yours on line 20.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    
    // This javascript sets the default value of a lookup field identified 
    // by <<FIELD DISPLAY NAME>> to the value stored in the querysting variable
    // identified by <<QUERYSTRING VARIABLE NAME>>
    // Customize this javascript by replacing <<FIELD DISPLAY NAME>> and 
    // <<QUERYSTRING VARIABLE NAME>> with appropriate values.
    // Then just paste it into NewForm.aspx inside PlaceHolderMain
     
    _spBodyOnLoadFunctionNames.push("fillDefaultValues");
     
    function fillDefaultValues() {
      var qs = location.search.substring(1, location.search.length);
      var args = qs.split("&");
      var vals = new Object();
      for (var i=0; i < args.length; i++) {
        var nameVal = args[i].split("=");
        var temp = unescape(nameVal[1]).split('+');
        nameVal[1] = temp.join(' ');
        vals[nameVal[0]] = nameVal[1];
      }  
      setLookupFromFieldName("<<FIELD DISPLAY NAME>>", vals["<<QUERYSTRING VARIABLE NAME>>"]);
    }
     
    function setLookupFromFieldName(fieldName, value) {
      if (value == undefined) return;
      var theSelect = getTagFromIdentifierAndTitle("select","Lookup",fieldName);
     
    // if theSelect is null, it means that the target list has more than
    // 20 items, and the Lookup is being rendered with an input element
     
      if (theSelect == null) { 
        var theInput = getTagFromIdentifierAndTitle("input","",fieldName);
        ShowDropdown(theInput.id); //this function is provided by SharePoint 
        var opt=document.getElementById(theInput.opt);
        setSelectedOption(opt, value);
        OptLoseFocus(opt); //this function is provided by SharePoint 
      } else {
        setSelectedOption(theSelect, value);
      }
    }
     
    function setSelectedOption(select, value) {
      var opts = select.options;
      var l = opts.length;
      if (select == null) return;
      for (var i=0; i < l; i++) {
        if (opts[i].value == value) {
          select.selectedIndex = i;
          return true;
        }
      }
      return false;
    }
     
    function getTagFromIdentifierAndTitle(tagName, identifier, title) {
      var len = identifier.length;
      var tags = document.getElementsByTagName(tagName);
      for (var i=0; i < tags.length; i++) {
        var tempString = tags[i].id;
        if (tags[i].title == title && (identifier == "" || tempString.indexOf(identifier) == tempString.length - len)) {
          return tags[i];
        }
      }
      return null;
    }

    This helpful tip taken from the Sharepoint Designer Team Blog.

    Post to Twitter Post to Plurk Plurk This Post Post to Yahoo Buzz Buzz This Post Post to Delicious Delicious Post to Digg Digg This Post Stumble This Post

  • Using Query String Parameters and Surveys

    Posted on May 13th, 2009 Eric 4 comments

    Today, in part 1, I’m going to describe how to use a query string parameter within a Sharepoint survey. This can be important for several reasons with the most notable being providing users a hyperlink to submitting a new survey from a work flow email. The hyperlink can have parameters attached to it to pre-populate data that you may not want the user to have to change. In part 2, I’ll describe how to use query string parameters to set Lookup field values.

    The below steps are the same for using a text or number field or a lookup field. What will differ is the code used to populate the fields.

    1. Open the site in Sharepoint Designer.
    2. Navigate to the Lists menu and expand out the survey in question.
    3. Make a copy of NewForm.aspx and rename it to something else, Survey.aspx or Feedback.aspx seem more fitting than NewForm.
    4. Open the newly renamed page.
    5. Delete the stock form from the lower pane.  If you get an error trying to delete it, try expanding the chevron and selecting Default to Master’s Content. Alternatively, set the IsVisable control from true to false. Deleting it could cause problems down the road as noted here.
    6. Click the chevron again and select the Create Custom Content link to create a PlaceHolderMain Custom area.
    7. Click the PlaceHolderMain Custom content area.  Insert a Custom List Form into the page from the Insert -> Sharepoint Controls menu.
    8. Set the top drop down to your survey list and ensure the New item form is selected and click OK.
    9. Click the chevron of this form and click the parameters link.
    10. Create a new parameter with the source being query string and give the parameter a variable name.
    11. Paste the below script into the the PlaceHolderMain area, substituting the Field Name and the parameter name with your values on line number 30.
    12. 1
      2
      3
      4
      5
      6
      7
      8
      9
      10
      11
      12
      13
      14
      15
      16
      17
      18
      19
      20
      21
      22
      23
      24
      25
      26
      27
      28
      29
      30
      
       
      _spBodyOnLoadFunctionNames.push("fillDefaultValues");
      function getTagFromIdentifierAndTitle(tagName, identifier, title) {
       var len = identifier.length;
       var tags = document.getElementsByTagName(tagName);
       for (var i=0; i < tags.length; i++) {
         var tempString = tags[i].id;
         if (tags[i].title == title && (identifier == "" || tempString.indexOf(identifier) == tempString.length - len)) {
           return tags[i];
         }
       }
       return null;
      }
      function setTextFromFieldName(fieldName, value) {
      if (value == undefined) return;
        var theInput = getTagFromIdentifierAndTitle("input","TextField",fieldName);
      theInput.value=value
      }
      function fillDefaultValues() {
       var qs = location.search.substring(1, location.search.length);
       var args = qs.split("&");
       var vals = new Object();
       for (var i=0; i < args.length; i++) {
         var nameVal = args[i].split("=");
         var temp = unescape(nameVal[1]).split('+');
         nameVal[1] = temp.join(' ');
         vals[nameVal[0]] = nameVal[1];
       }  
       setTextFromFieldName("theFormFieldtoPopulate", vals["myQueryStringName"]);
      }
    13. Save and Close the file. Test the form to see if it is in fact accepting your parameter. Navigate to the URL and append ?YourParameter=SomeValue to the end. When you hit enter, the new survey form should appear with the parameter value in the specified field.
    14. Go back to Sharepoint Designer and right click on the survey. Select Properties and click on the Supporting Files tab. Change the New item form to the newly created page by clicking the Browse button and navigating to it. Click OK to apply the change.

    Now this parameter can be leveraged in work flows that email users by creating a URL and grabbing a look up value from Sharepoint list data. This provides 1 click access to users to get to and fill out a survey. In part 2, I’ll describe a scenario where a look up column needs to be populated. For further information, see the Sharepoint Designer Team Blog for other use cases.

    Post to Twitter Post to Plurk Plurk This Post Post to Yahoo Buzz Buzz This Post Post to Delicious Delicious Post to Digg Digg This Post Stumble This Post

  • Admin page in the Employee Training template

    Posted on May 8th, 2009 Eric 1 comment

    This week my focus was to start testing a software upgrade but that got hijacked due to database issues. So I took the opportunity to finish the final features of a customized Employee Training template that we deployed to handle workshop registrations. The last few hurdles I was working on were usability issues to take it from ok with some workarounds to functional as is.

    I created a Administration page for the admins to manage some functions that they’d need to do. Mainly see a list of upcoming workshops, who is attending, being able to email 1 or all users and being able to export the roster to make sign in sheets. We also have a broken iCal function right now but that will be covered when that gets fixed.

    The data view web part on the page gets information for the courses being offered and when the filled seats is clicked, it passes the courseid variable into the registration list to get the users. Nothing too magical here. But wait, we’ve got a phone number field that is displaying all sorts of jibberish like ,#Domain\user,department,etc. Will looking at this user profile, they don’t have a phone number listed in their Sharepoint profile. Easy fix with some XSLT. I found the td that outputs the phone number and changed it to the following.

    
    
      Not Listed
      
      
      
    
    

    Nothing too hard there.

    CSV export. I thought this was going to be impossible or at least very difficult. A little Googling and I found a great, easy to use jQuery solution called table2CSV. Shout out to Kunal Babre, this script rocks! Used option 1 for this scenario. I created a sample page in SPD and added 2 buttons to the page, copied the HTLM and slapped it into a Content Editor Web part. I added an onclick reference to the jQuery function and presto, a popup window with comma delimited data for the list! Wow, great 2 problems solved with little coding, great for us code stupid people.

    Now comes the email requirements. I needed help from Tony Miller, colleague here and our go to guy for jQuery, to help with this. Again we went back to SPD and added an email id on the td that generates the email address for the registrant list. Now we have our selector to grab this information. One major problem though, all the fields are being displayed as rich text, if we stet them to plain text in the SPD data view options, it returns nobr span mumbo jumbo. So we did some more jQuery embedded in a content editor web part.

    $('td.RegList nobr span a').each(function (i) {
    		$(this).parent().html($(this).text())
    	});
    

    What this does is strip all the HTML in the Registrant table, defined by another id we tacked onto the tds, and returns it’s text value. Good, now we can use the information better.

    I added an additional column to the registration list that will hold the hyperlink so that the admins in 1 click can email an individual registrant. Now with some more jQuery, we can fill in that value. We assigned that td an id of MailtoLink so the function would know where to output the information.

    $('td.MailtoLink').each(function (i) { 
            $(this).html('<a href="mailto:' + 
                   $(this).parent().children('td.email').text() + 
    '?subject=Upcoming Workshop' + '">E-Mail Registrant</a>')
            });

    Boom, hyperlink fills the table cell and we are almost done.

    The last bit was to create a mail all users option. I had to turn to Paul Grenier, a moderator over at Stump the Panel on EndUserSharepoint.com. Great information in STP and on the site. Bookmark and RSS it, the content is amazing. Paul came back with some psuedo code and some jQuery to get it working. It can be found here.

    Tony and I had to make some tweaks to get it working. We removed the validation step from it since the information wasn’t manually input, it came from Sharepoint and Sharepoint provided it as an email address. Our final code loos like this, and is attached to the other button, named EmailButton, I created.

    $('#EmailButton').click(function() {
       var validEmails = [];
       var emailstr;
         $(".email").each(function(i) {
         validEmails.push($(this).text());
        });
       var url = 'mailto:' + validEmails.join(';') + '?subject=My%20Subject';
       var emailwin = window.open(url, "EmailWindow");
       emailwin.close();
      });
    }); 

    This process has been a lot of work but has been extremely rewarding. The feedback I’m receiving from the group this is designed for has been so positive and they are very excited. What more can you ask for than for people who are excited to use Sharepoint? Many thanks to Tony, Paul, Laura, and the Twitterverse that has helped with some of these issues.

    Post to Twitter Post to Plurk Plurk This Post Post to Yahoo Buzz Buzz This Post Post to Delicious Delicious Post to Digg Digg This Post Stumble This Post

  • Folders and Metadata

    Posted on May 4th, 2009 Eric No comments

    This afternoon we started having a discussion on Twitter about metadata and folder structures within a document library. 140 characters was too few for me to really get into the nitty gritty so I’ll expound a bit.

    I detest folders in libraries, although I have implemented a few folder based libraries because item level security required it. The only other time I’d consider folders is libraries where you start running into that 2000 item per view limit.

    That being said, I had a user today need help organizing a library to show subfolders in the appropriate month order. To detail further, we have an environment where site collections are provisioned as desired and I serve in a capacity to oversee that process and consult and train owners of the site collections as needed. This was a case where I knew the right method, metadata and grouped/sorted views, was going to be the wrong path to take. I chose the work around to rename the folders so that it would sort properly instead of reworking their entire library.

    Sometimes you have to choose your battles, after assessing the situation, I opted for the “wrong way”. If this was one of my power users, I’d definitely have pushed to the best practice method.

    This is one of those great debate topics in Sharepoint and once you get it, you’re like “wow”. It really is an eye opener in administration when you make that synapse connection.

    Post to Twitter Post to Plurk Plurk This Post Post to Yahoo Buzz Buzz This Post Post to Delicious Delicious Post to Digg Digg This Post Stumble This Post

  • Sharepoint Saturday Recap

    Posted on May 3rd, 2009 Eric 1 comment

    Wow what a great day of events Saturday at Microsoft for Sharepoint Saturday. Great job organizing this event Dux, @meetdux, it was awesome and smooth. A bit of a recap of the sessions I attended.

    After a killer Keynote with Joel Oleson, NS Rana, Thomas Vander Wal, and Errin O’Connor, the event broke out into End User, Developer, Admin and Special Interest sessions. The first session I attended was Eric Harlan’s, @ericharlan, presentation on Federated Search. Wow, is this easy to configure and get running. This will be of great benefit to pull search results from external sources and not have to index that on the farm, good stuff. This is going to be of benefit once we get the infrastructure updates in place.

    Dan Lewis, @danlewisnet, put on a good demo of the Sharepoint blog and how it can be accessed with Word (my favorite, do this every week) and Live Writer, which I need to try. He also made mention of Lee Reed’s series on endusersharepoint.com on how to pimp your blog. Also check out PixelMill for Sharepoint skins for your blog. Good stuff by @hwaterman.

    Joel, @joeloleson, put on a great demo of Twitter and Sharepoint administration. The room was packed, and the live feed was dropping people. There were over 50 people watching his presentation via the web cam that was set up. Joel lived up to his Sharepoint rockstar persona.

    I had high hopes for the calendaring in Sharepoint sessions put on by Julie and Daisy from Bamboo Solutions. It unfortunately took a sales pitch approach for a few of their web parts. This isn’t necessarily bad, as they were a sponsor, but I had hoped that they’d show some more detailed uses of the calendar in Sharepoint, similar to Mark’s creating a master calendar.

    Paul Galvin, @paulgalvin, shared experiences in creating vertical applications within Sharepoint. His point of using Sharepoint as a platform to solving business needs is spot on. Lead and development time is significantly shorter than in the standard ASP.Net Visual Studio cases. I can’t wait to do more business process application solutions in our environment.

    The last session of the day was Content Types with Kenneth Lo, @kenneth_lo. This was a great refresher session for me. I struggle at times using content types. They are definitely powerful in resolving the typical network folder structure.

    All in all this was a great day. Lots of great people and prizes, won a raffle for Sharepoint 2007 Unleashed. I had thought I ordered this from Amazon in the past but snafu-ed and got the Project Server version, oops. I’m excited to go through it. I got to meet Mark, @EUSP, in person. We didn’t get much time to chat unfortunately. Also I met Ruth, @rlilly, who is trying to get a user group started in eastern NC for Sharepoint. I’m looking forward to hearing something on that front. There are like no user groups east of Raleigh, except for the Tweet ups in Greenville. Definitely looking forward to the next Sharepoint Saturday in DC and/or Charlotte.

    If you hadn’t noticed, there were a lot of Twitter folks there. If you aren’t using it, start, it’s a great tool.

    Post to Twitter Post to Plurk Plurk This Post Post to Yahoo Buzz Buzz This Post Post to Delicious Delicious Post to Digg Digg This Post Stumble This Post