How To Create SharePoint Document Library Subfolders Programmatically

Don’t you just love it when you’re slaving away at something that should be pretty straight forward but you just can’t figure it out? Well I just had one of those breakthrough moments and thought I’d share. I spent almost the entire day yesterday searching and trying different ways to add sub folders to Document Libraries programmatically to no avail. I was seriously pulling my hairs out. And then just 30 mins ago, I came across this blog post and now I can go take a 3 hour lunch. Here’s my variation of the code:

private void AddFolders(SPList list, SPWeb web)
{

String url = list.RootFolder.ServerRelativeUrl.ToString();

SPFolderCollection folders = web.GetFolder(url).SubFolders;

folders.Add(“Yay this works”);

}

Long live the blog!

Custom MOSS 2007 Portal Landing Page using Moo.fx for Navigation

I’ve been promising a bunch of people this blog post for the longest time and now I’ve finally got a chance to do a little writeup. This was done probably 4+ months ago as a yearning for a more user friendly intranet portal landing page. Here’s a thumbnail of it (Click for larger size):

Custom SharePoint Portal Index Page

So how did I do it?

Using a Collaboration Portal as a base, I created a totally blank .aspx page and inserted only the bare minimums from Default.aspx for a SharePoint page to be able to run. That’s basically everything above the SPWebPartManager Control in the body of Default.aspx:

 <body scroll="yes" onload="javascript:if (typeof(_spBodyOnLoadWrapper) != 'undefined') _spBodyOnLoadWrapper();" style="text-align:center; ">

  <form id="Form2" runat="server" onsubmit="return _spFormOnSubmitWrapper();">

 <WebPartPages:SPWebPartManager id="m" runat="Server"/>

With the prerequisite SharePoint code registers/headers and javascripts calls (is there a better name for this?) in place, I then created a custom table layout for all of my content and placed Web Part Zones into table cells where I wanted to use Web Parts. Sorry, no pictures here.

Next, I copied and pasted from default.aspx all of the SharePoint controls that I wanted to reuse on my page. This included the Welcome, Global Site Links, and Search Controls.

Navigation

Then for the right navigation into the portal’s sites, I wanted something that was collapsible as we had nearly 50 sites that needed to be within one click of this main index page. I thought about using the Accordion control of the ASP.net AJAX Control Toolkit but couldn’t figure out how to make it work for some reason. I then tried some moo.fx and was able to get that to do what I wanted pretty quickly and with few tweaks so that’s what I ended up using. I simply placed the javascripts into a folder within my portal where I could easily remember reference it and added this line of code to my page’s <head> section:

 <script type="text/javascript" src="javascripts/mootools.js"></script>

I had placed the moo.fx scripts into http://portal/pages/javascripts/

Company Announcements & Upcoming Events

For these, I took advantage of the Data View WebPart within SharePoint Designer to display the contents of an Announcements List and a Calendar. The Announcements List is also email-enabled so users with the correct permissions like HR would be able to just email their announcements for it to appear on this index page.

The Events Calendar was a little bit more tricky and needed some xsl editing as by default it would also display the time right next to the date. That was a nuisance for all day events in which it would just say 12:00 AM. I think this was fixed by updating the xsl to:

<xsl:value-of select="ddwrt:FormatDate(string(@EventDate) ,1033 ,1)"/>

Unfortunately I forgot what the original xsl was…

Quick Links

These are all static HTML links to sites and pages throughout the portal.

Recent Blog Posts

Super easy, just use the Content Query! Content Query WebPart that is. We had the blogs hosted in the same site collection so we were able to use this to aggregate an X number of blogs and post the newest ones from top to bottom.

Custom CSS

I actually stuck with Default.Master as the masterpage for all of my subsites as that was the best layout for collaborative workspaces but totally redid all of the styles to reflect this company’s branding. For that I created a new CSS file and went through the SharePoint sites using the IE Developer Toolbar to figure out which styles were being used for what part of the page. Heather Solomon’s CSS Reference Chart was also a huge help. Then I went to the original CSS file that contained the style I was looking for, copied and pasted it into my new Custom CSS file and tweaked it with intentions of just overriding the default ones. Yes, I know this isn’t ideal because both style sheets get loaded and the styles basically get rewritten but if anyone knows of a better feel free to let me know!

Implementing All Of This

I didn’t want to delete the original Default.aspx page in case I needed it for something later on, so I used the Welcome Page setting underneath Site Settings instead. This is at http://portal/_layouts/settings.aspx underneath the ‘Look and Feel’ section. This basically enables you to tell the portal which page to make the default page upon loading this website which I directed to my custom .aspx index page.

For the custom CSS, I went to the Site Master Page Settings page underneath Site Settings again and way at the bottom is where you can define an Alternate CSS URL. I selected the radio button for “Specify a CSS file to be used by this publishing site and all sites that inherit from it.”

That’s about it! Hope this post was useful and thanks for reading!

Nintex Workflow 2007 for SharePoint Review: 1.5 Thumbs Up

Not too long after giving up on Bluespring’s BPM solution I came across Nintex on advise from somebody in the SharePoint community message boards. I think it was Ishai Sagi… Nonetheless I promptly signed up for the Nintex Workflow 2007 Beta and then their Release shortly afterwards. Ok, enough gibberish, so here’s my quick and dirty run down on my impressions of this software:

  • Workflow 2007 is built as SharePoint Solution files and enabled using Features.
  • Totally leverages the existing SharePoint workflow engine, no need to install any other process engines, or clients. Basically just upload the Solution files and install via Central Administration.
  • The workflow designer is built into each site and can be enabled as a Feature.
  • The designer utilizes AJAX enabling you to create the workflows ala Visio drag and drop style right in the browser. (That was key for me, no need to install separate designer client).
  • Email enabled workflow approvals. Using their LazyApproval system you can just reply to the workflow email with specific keywords to enable it to continue.
  • The UI is one of the best, very easy on the eyes.
  • Feature set may not be as robust as other full blown BPM solutions.
  • Relatively cheap (~$7000 US) and no crazy software licensing schemes. You can even buy it right off of their website without having to haggle with sales guys.
  • Tech Support was AWESOME. The couple of emails and bugfix requests that I sent them were totally attended to and resolved by the very next business day.

Nintex Workflow 2007 is definately welcome in any of my SharePoint implementations as it is very easy to install, administer and use. The browser based designer would enable any business user to be able to design workflow processes. So why only 1.5 thumbs up? Well, it could always be better 🙂

I wonder if anyone from Nintex will see this post…maybe they can send me some schwag eh? 🙂

BlueSpring BPM For SharePoint Review: 1.5 Thumbs Down

Awhile back I was working with a company that was interested in a more robust workflow design experience compared to what was available OOB with MOSS 2007. We decided to give BlueSpring Software a shot since, at the time, they were one of very few companies that claimed to have tight integration with MOSS 2007 (this was before MOSS RTM’ed). The list price on their Business Process Management software was $120,000 at the time but we were able to haggle them down to the mid-$30k’s which should have been a sign of things to come.

The feature set demos for the software package were quite impressive, it basically did just about anything you could want from automating tax forms to making you breakfast… well almost.

After sending off some paperwork, we were provided with a link to download the software bits and a LiveMeeting appointment with their technical support to walk us through the installation. The support wasn’t bad, but here’s where the fun began.

  • The installation took almost 1 hour to install with live hand-holding from tech support – no joke.
  • The software literally didn’t work out of the box after installation.
  • Many things had to be manually edited (web.config files, xml files) to get it up and running for a clean MOSS 2007 Box. 
  •  There were too many components (BPMweb, BPMdesigner, and others).
  • We spent nearly a week trying to get all the documented ‘Features’ of the BPM Suite to work after which I just gave up on their software.
  •  No web based Workflow authoring tools – had to use an installed client software.
  • User interface and Design reminded me of Windows 98.

I’m sure BlueSpring Software’s a wonderful Business Process Management tool for non-SharePoint environments but it extracts no value from any pre-existing SharePoint investments your business has already made. Next time I’ll do a write-up on one company that has built their workflow product specifically as a SharePoint Solution in which you can graphically design processes from right within your SharePoint sites!

Moving SharePoint Sites using STSADM

Just a note to myself since I keep confusing this with the Backup/Restore method:

 When trying to backup and restore a site you can use SharePoint Designer 2007 to do this, but you can also use STSADM:

STSADM -o export -url <url> -filename <filename> -includeusersecurity -versions 4

STSADM -o import -url <url> -filename <filename> -includeusersecurity

Note the URL being imported into should be created in SharePoint Designer with an Empty Website.

IT Skills to have for 2010 and beyond

http://www.computerworld.com/action/article.do?command=viewArticleBasic&articleId=112360&pageNumber=1

Technology Infrastructure and Services

  • Systems analysis
  • Systems design
  • Network design
  • Systems auditing

  • Programming
  • Routine coding
  • Systems testing
  • Support and help desk
  • Operations — server hosting, telecommunications, operating systems

Cisco Unified Communications and Office 2007 Integration

I recently attended a Cisco Executive Demo Session which was one of the best seminar/demos I’ve ever been to. Short and sweet interactive demos, wish I had brought a camera to take pictures and video.

Cisco Collaboration Application:

  • Very similar to GoToMeeting/WebEx
  • Schedule meetings with Outlook
    • Recipients get a URL link to login to.
    • Share screens.
    • Share mouse & keyboard control.
  • MeetingPlace Express (Small/Medium Business Level) supports up to 200 concurrent users (Phone & Data) on the system.
  • Unified Communications Client (I forgot the official name for it) works a lot like Skype – Phone, Instant Messaging, Phone Book Directory Lookup, Video Chatting.

TelePresence:

  • Very cool – Product stats page: http://www.cisco.com/en/US/products/ps7060/index.html
  • At the bottom of the table, there’s a projector that displays laptop hookups
  • The image is automatically switched to which ever location has their laptop plugged in to the VGA cable.
  • They also have a 1 screen version and multi-TelePresence configurations.

Office 2007/ Exchange 2007/ Microsoft Compatibility Roadmap:

  • Unified Communications will pull information from Exchange Server 2003/2007 LDAP connections.
  • Out of the ~10 Cisco reps/systems engineers there, none could give a clear answer on any integration/compatibility with Office 2007 clients or SharePoint Servers.
    • They seem to be trying to solidify their presence in the telephony/virtual communications space by working as little as possible with Microsoft integration and providing their own custom client software and solutions.

I also recieved the following email a couple days later in response to some more detailed questions:

“Right now, by using [Microsoft Office Communicator and Office Communications Server as a 3rd party call control agent for our IP phones, we can integrate presence and click to dial into the Office 2007 applications. There is no native integration of our solutions into Office 2007 desktop applications. Our Strategic Alliances group is in conversations right now with Microsoft on integrating our Unified Communication systems into Sharepoint. Keep in mind there is nothing in concept commit though, meaning only talked about.

With respect to a Web API, our acquisition of WebEx has openned up some intriguing possibilities in that regard; both from an API as well as client perspective. Again, there is nothing that has been committed only talked about.”

Information Managers and SharePoint 2007 Content Types

I had this post in my queue for the longest time and never got around to publishing it. It’s a great article about Intranet Managers by Paul Chin – http://www.intranetjournal.com/articles/200703/ij_03_12_07a.html.

A lightbulb above my head went ding! after I read that article and I thought a more fitting title for the role of Intranet Managers would be Information Managers. This, I believe, is due to the fact that as more companies evolve and migrate their paper content to digital media, Intranet Managers will eventually evolve themselves to have a larger footprint. Not only providing the bridge between business, tech and other information silos, Information Managers will ultimately be responsible for providing the governance to all of this content and information. 

With my own experiences, implementing SharePoint as a hybrid intranet/collaboration environment, I’ve often times had to decipher the content and organizational structures of digital content myself. That’s where the beauty of metadata and Content Types within SharePoint comes in. I can create mandatory metadata fields and Information Policies to help manage all of this information better. For example, I have a Document Library that project managers can use to store all their documents. With mandatory metadata fields that need to be filled out upon uploading a document, we will be able to more easily search/filter/create special views for the most relevant information.

I previously wrote about using Content Types and Document Templates here: https://blog.henryong.com/2007/02/12/how-to-create-document-templates-for-document-libraries/

MOSS 2007 Backup/Restore Quirks and Site Migration

Dude, I just spent the entire morning trying to restore a MOSS database and man did it suck. I was originally asked to delete a link to a document workspace from a site’s quick launch navigation. It looked like MOSS was playing tricks on me again, ever notice how sometimes subsites don’t get included on the parent’s quick launch? And sometimes they’re duplicated? In my case, I thought the user had just created duplicate workspaces so I just clicked on one and deleted the site. Should’ve been that simple right? Wrong…

 I went back to the parent site and both links were gone! I was like aww crap… I knew what had happened and I knew the recycle bin doesn’t support deleted sites. But I checked the recycle bins anyways. No dice. Next step – restore last night’s backup to a different server.

 This part just blew my mind, I had restored hundreds of content databases and attached them to web applications before no sweat. But for the life of me I couldn’t get any web applications I had created to recognize any of the sites in the content database. It would just say there was 0 sites in the site collection. After unsuccessfully trying to restore this database, I finally threw my hands up and booted up an old virtual machine that had a fresh MOSS 2007 install on it. Restored the database to that machine, created a new web application, attached the database and voila! Everything’s there.

Then I proceeded to use the content migration feature of SharePoint Designer to backup and restore the content. I have no idea why neither my production or test MOSS server wouldn’t recognize the sites from attached databases. Anybody else come across a similar problem?

Time to install the SharePoint Governance and Manageability tools from Microsoft IT…

SharePoint Customization Lessons Learned From the Past 2 Weeks

The last couple of weeks have been crazy busy for me. Mainly due to getting more requests from users that wanted new features implemented and content deployed. I was so freakin’ busy I hadn’t even had time to check any of my Google Reader feeds for the past 2 weeks! I thought I’d try to catch up with my blogging by posting some of the SharePoint lessons I’ve learned over the past couple of weeks.

InfoPath forms

  • They’re OK, easy to use and easy to implement.
  • Having all your forms depend on Forms Services is a pain (my end users don’t have the InfoPath clients installed).
    • Can’t save to computer, can’t email.
  • Good for short and sweet transactional forms.
  • Not good for forms that might take a few sittings to finish like the ones from HR  *cough* performance appraisals *cough* .
  • XHTML rendering is pretty cool.
  • XHTML rendering puts a big dent on browser rendering performance.

MasterPages

  • Are not my friends.
  • For some reason, if you’re using SharePoint as a collaboration tool there are lots of little quirks if you use anything other than default.master.
    • Some examples: Vertical picture libraries, layouts aren’t always cross-browser compatible, stuff moves on hover when it shouldn’t.
  • It’s much easier to use the default.master and either create your own theme or do what I did and just use a custom CSS file.

CSS Customizations

  • Not so hard to do, I was able to change every style used for default.master in 2.5 days.
  • Use the IE Developer Toolbar!
  • Do not change any of the styles in core.css
  • Make a copy of core.css and edit the copied one.
  • On the MasterPage settings page, use the CSS override feature to apply your custom CSS so you can always revert back to the original if you need to.

SharePoint Designer

  • Oh lordy, I think this software is worse than FrontPage sometimes.
  • Great tool for customizing SharePoint pages  and content data.
  • The Data View web part is awesome!
  • Damn thing crashes every half hour.
  • Crashes every time there’s bad HTML that it can render in design view.
  • I can’t seem to get undo to work on any SharePoint pages after saving it. Works fine for CSS files.
  • It gets really confused sometimes and can’t figure out if a file is checked-in or out.
    • Sometimes I’ll have to go into the MOSS content management to check-in documents in order to check them out in SharePoint Designer.
  • It gets really confused if you change the welcome page on your publishing portal and then rename the file in SharePoint Designer.
    • I haven’t found any fixes or workarounds for this yet – I’m basically screwed and can’t reuse names that have already been used like default.aspx.

Custom Default.aspx Pages

  • For publishing portals, you can’t just replace default.aspx with your custom code.
  • From the Top Level Site > Site Actions > Site Settings > Look and Feel > Welcome Page > Change the path to your custom page.

Ajax for SharePoint

Now to catch up on some reading…

Design a site like this with WordPress.com
Get started