Archive for Sharepoint

Sharepoint Dev Rocks

// April 15th, 2008 // No Comments » // Sharepoint

In the beginning of time, when Sharepoint was but a baby (ok not in the Sharepoint 2001 foetus stages), customizing Sharepoint was difficult. It was almost like Microsoft had brought out Sharepoint 2003 to be used as is and development had to be done by ‘bastardizing’ Microsoft’s source code and general sneakiness. Fair, there was allowance for web parts, but general UI and list and site customization was difficult.

Sharepoint 2007 came out in its BETA stages and the ideas were definitely there from Microsoft’s side. They understood the need for the customization of their product and the fact that organisations used this multipurpose tool as basis for many of their business functions. Now MOSS has become a product which is compatible with all Microsoft Products, integratable into many different 3rd party products (BDC etc), and can be extended through the WSS Extensions for Visual Studio and using components such as site content types, list content types, and site features.

And the best part of this is that it is totally supported by Microsoft, after all they gave us the facilities to do this!!

So big up to Microsoft for a great product!

Creating a custom property for your toolpart

// March 31st, 2008 // No Comments » // Sharepoint

For a while now ive wanted to create a custom property for my toolpane on a webpart. After reading many blogs, i finally came across a site which helped me accomplish this. In the example below i wished to create a dropdownlist on the toolpane. Once you get this working you’ll see that it is possible to add any type of control to the toolpane and pass values from the toolpane to your web part on the apply method. Here is the Toolpane class:

<br /> public class CustomToolPart : Microsoft.SharePoint.WebPartPages.ToolPart<br /> {<br /> DropDownList ddlTypes = new DropDownList();<br /> public CustomToolPart()//Constructor<br /> {<br /> this.Title = "Select Type";//Set the title for our custom tool part.<br /> }<br /> protected override void CreateChildControls()<br /> {<br /> PopulatePageTypes(); //Method to populate the drop down list.<br /> Controls.Add(ddlTypes);<br /> }<br /> public void PopulatePageTypes() {<br /> SPSite oCurrent = SPContext.Current.Site;<br /> ddlTypes.Items.Add("Tester");<br /> ddlTypes.Items.Add("Tester1");<br /> }<br /> public override void ApplyChanges()<br /> {<br /> Class1 wp1 = (Class1)<br /> this.ParentToolPane.SelectedWebPart;<br /> // Send the custom text to the Web Part.<br /> wp1.Text = ddlTypes.SelectedItem.Text;<br /> }<br /> public override void SyncChanges()<br /> {<br /> // sync with the new property changes here<br /> }<br /> ///<br /> <summary> /// Called by the tool pane if the user discards changes<br /> /// to the selected Web Part.<br /> /// </summary> <p> public override void CancelChanges()<br /> {<br /> }<br />

As you will see in the code above, you simply pass the value back in the ApplyChanges() method. Here is the webpart class:

<br /> public class Class1 : Microsoft.SharePoint.WebPartPages.WebPart<br /> {<br /> private string _exceptions = "";<br /> private const string sImageLib = "";<br /> private string sLib = sImageLib;<br /> protected System.Web.UI.WebControls.Label lblError;<br /> protected StringBuilder sb = new StringBuilder();<br /> private const string defaultText = "Your text here";<br /> private string text = defaultText;<br /> public string Text<br /> {<br /> get<br /> {<br /> return text;<br /> }<br /> set<br /> {<br /> text = value;<br /> }<br /> }<br /> public override ToolPart[] GetToolParts()<br /> {<br /> ToolPart[] toolparts = new ToolPart[3];<br /> WebPartToolPart wptp = new WebPartToolPart();<br /> CustomPropertyToolPart custom = new CustomPropertyToolPart();<br /> toolparts[0] = custom;<br /> toolparts[1] = wptp;<br /> // This is the custom ToolPart.<br /> toolparts[2] = new CustomToolPart();<br /> return toolparts;<br /> }<br /> protected override void RenderWebPart(HtmlTextWriter output)<br /> {<br /> output.Write(SPEncode.HtmlEncode("Your custom text is:" + this.Text));<br /> }<br />

Free Webpart: The Expert News Rotator preview

// March 26th, 2008 // 3 Comments » // Sharepoint

The Expert News Rotator Webpart uses the JQuery Image Rotator interface to list the latest announcements on your MOSS/WSS site.

Using this slick new JQuery UI as a presentation feature, the webpart is configured to show items from an Announcements type list. The list is configurable such that:

1) The number of “Announcements” can be varied
2) The style sheets (CSS) are interchangeable such that you may change the design of the webpart
3) Date Formats can be varied between DD/MM and MM/DD

Each News Item is directly linked through to Sharepoint Announcement List Item itself.

The webpart is currently in a testing phase and will be released soon… watch this space

Migrating Sharepoint Site Collections

// February 25th, 2008 // 1 Comment » // Sharepoint

Last week i was challenged with migrating 2 site collections from a development box to a brand new instance of Sharepoint. I’d heard that migrating site collections was pretty easy and soon stumbled across this post by Microsoft.

If you follow it you should be fine, as the import pulls in all the content from the existing SQL content tables into the new blank sites SQL tables, so there is no need for any SQL migration.

Sharepoint Excel Services: Setting up report parameters

// February 25th, 2008 // No Comments » // Sharepoint

Over the past few days ive been exploring the possibility of using Excel Services to solve some of the reporting problems for a IT management portal which would expose charts and data on:

1. Planned Downtime
2. Unplanned Downtime
3. Cumulative Downtime (Y2D)
4. Percentage Downtime

and all the other great things CIO’s like to see. Presently the data and reports are distributed ala ’6 versions of Excel document emailed around’ and updated by one person. We needed to change this.

Excel Services has on many sites, Microsoft ones especially, been talked up a fair bit. Rightly so. The possibilities are endless when one allows an Excel spreadsheet to be exposed almost in an ‘iframe’ way, where users can interact with it in a read only way on the reporting dashboard.

Another handy feature (when i finally worked out how to use it) is the ability to pass parameters to pivot-tables within the Excel workbook and thus generate range specific reports and charts. I found this feature especially handy since it opens up the doors for vastly different dashboards. Setting this up however can be a mission. Firstly generate the sample dashboard so you can see how they did it, it really helps to see how Microsoft achieved this before setting out to do it.

I battled to find anything which stepped it out on the net, so heres my recollection on how to create charts where different date parameters can be passed to generate different reports:

1. You HAVE to have Excel 2007
2. Open up your datasheet and insert a pivot chart by selecting the data you wish to chart
3. In your Pivot-table Field List (pops up once you select your data) select the fields you wish to report on.
4. Choose a field which will be your ‘Report Filter’
5. This will generate a cell on your worksheet where you will be able to filter the field values you just chose.
6. Click on this cell and name it (so if the cell is A2, you will see the A2 name in the far left hand drop down: change it)
7. When you are ready, publish the document by clicking the Office logo and choosing Publish
8. Click the ‘Excel Services options’ button before you publish
9. Choose the Chart you just created then click on the paramaters tag
10. Add in the parameter you just created.
11. Publish

Then:

On your reporting dashboard open up a Excel Web Access web part and a filter web part depending on the values you wish to pass. Once you have chosen the chart on the Web Access web part (named item) then modify the filters properties. Send filter values to the web access chart you just created and make sure in the ‘Configure connection’ you choose the paramater you just published.

Hope my experiences helped you!

Sharepoint: A Social Networking tool?

// November 30th, 2007 // No Comments » // Sharepoint

For those of you who need a bit of a background:

‘SharePoint is a portal-based collaboration and document management platform from Microsoft. It can be used to host web sites, termed SharePoint Portals, which can be used to access shared workspaces and documents, as well as specialized applications such as wikis and blogs, from within a browser.’ref: http://en.wikipedia.org/wiki/SharePoint

Sharepoint uses single sign on to identify users as they login with their windows login, and therefore is able to target information and documents accordingly to employees. It is a network of information which is shared throughout an organsation.

So with that basic understanding of what it does, you’ll ask, so how does this affect Social Networking? well here goes:

Facebook, MySpace, LinkedIn, Orkut….. I could go on and on.

The entire world is on the internet and a good part of the entire world is on one of the social networks! Many people would include this as one of their social activities and more importantly, most people for some or other reason enjoy divulging information which they wouldnt share to ordinary friends, hidden behind a profile pic and a couple of photos of their last party.

If divulging information, sharing thoughts and ideas and freedom of speech is a pattern for people who engage with social networks, then would this information not be relevant or important to Managers of employees and CEO’s given the same idea on an internal social network?

6000 employees, some discussion forums, some groups, some photos, a newsfeed. For a manager this maps out social friends groups, strategic friends groups, problems, solutions, pros and cons, likes and dislikes of an organisation, whilst employees actually enjoy this kind of interaction. The proof of that comes from organisations actually blocking access to the Facebooks and Myspaces globally.

So then you would ask, why would an organisation opposed to external social network interaction (Facebooks etc) be interested in bringing it within their networks? My answer: Employees using an internal network connect with their colleagues only. Therefore I feel that any interaction would center itself around mutual experiences, which are 99% of the time based within the organisation. Use yourself as an example. Pick a work colleague. Go out for a drink or coffee. What is the crux of your conversation? Im willing to bet that 90% of the time itll be work related.

Sharepoint, if setup properly, can have two separate working environments (well more but for this purpose we’ll discuss these), the mysite and the standard intranet working environment. So the latter is where for instance the business units (eg HR) setup their sites and share info and documents relevant to their departments. Mysites are sites which are unique to a user, where very similarly a user may setup their own site, with their own documents, and add items (web parts) to the page such as your outlook inbox and calendar. A picture is worth a thousand words. Click the pic below to open a larger view.

Mysites

The social network could be driven through the mysite. In the same way Facebook allows you to have different parts on the page (eg newsfeed, thewall etc etc), Sharepoint could be setup to have these as web parts (for those of you who have no idea what a web part is – see Memberships or Colleague Tracker on the pic above).

In addition managers could be allowed access to web parts which map out social timelines, friends networks etc etc of all their employees. INVALUABLE information!

So all in all, a project which im sure has been considered in Silicon Valley, and if it hasnt I say: Microsoft, if you out there, hows $200000 and a year of solid work?

Sharepoint 2007 Service Pack 1

// November 30th, 2007 // No Comments » // Sharepoint

Check the link here

I hope it brings much joy to Sharepoint Admins worldwide. I like the AJAX idea!

Sharepoint “access denied” error

// November 1st, 2007 // No Comments » // Sharepoint

Recently I started a new deployment for a client. I started redesigning the site using the masterpage as my first point of call. The client wished to login and view my progress. However, even after i had given them access using my site collection administrator account they’d still get an access denied error and the option to sign in as a different user.

Well i think i solved this little problem. It seems that i had left the masterpage file ‘checked out’. When I published a major version of it and approved it etc, and then let the client try and access the site, everything worked! Amazing!

Well if you have this problem, check which files are checked out. Check everything in and see if that makes a difference. Hope it helps!

Sharepoint Webpart: Media Player

// October 24th, 2007 // 2 Comments » // Sharepoint

Often I need a web part for clients which is able to play video, well i found one. However i had to make a couple of minor changes to get it onto MOSS – as follows:

1) Add the safecontrol to the web.config file as specified
2) Add the following line under the assemblies tag in the web.config: add assembly="MediaPlayerWebPart, version=1.0.0.0, Culture=neutral, PublicKeyToken=4907dffeafb11512"
3) throw the .dll into the GAC (c:\windows\assembly)
4) do an iisreset

5) Then download the following file and rename its extension to .webpart – so mediaplayerwebpart.webpart

6) Goto site settings (on the top level site) and go to web parts. Click upload
7) Browse to the file you uploaded above
8)) Go back to any site and drag the web part onto the page!!

Done deal!

Sharepoint Workflow: Hitches

// October 22nd, 2007 // No Comments » // Sharepoint

Following on from my last post, i just have one hitch which i wasnt able to solve. I googled it til I google was blue in the face but could find nothing. I needed to send an email during my workflow. Strangely there is a workflow tool called SendEmail, which i dragged onto the design page and attempted to write some code for. However every time I tried to send the email I got the following error:

The e-mail message cannot be sent. Make sure the outgoing e-mail settings for the server are configured correctly

The server settings are configured fine because task notifications are sent out perfectly. I tried a few suggested fixes I found through google groups but none worked. I eventually replaced my SendEmail activity with a code activity and used the System.Net.Mail way of sending the email. In case you unaware:

MailMessage mailMessage = new MailMessage();<br /> MailAddress from = new MailAddress(sFrom);

mailMessage.From = from;<br /> mailMessage.To.Add(sTo);

mailMessage.Subject = sSubject;<br /> if (HTMLMail)<br /> {<br /> mailMessage.IsBodyHtml = true;<br /> mailMessage.Body = sBody;<br /> }<br /> else<br /> {<br /> mailMessage.IsBodyHtml = false;<br /> mailMessage.Body = sBody;</p> <p> }

string smtpServer = "";<br /> System.Net.Mail.SmtpClient mail = new SmtpClient();<br /> mail.Host = smtpServer;<br /> //mail.Credentials = oNetworkCredential;<br /> mail.Port = 25;<br /> mail.DeliveryMethod = SmtpDeliveryMethod.Network;<br /> mail.Send(mailMessage);<br /> mailMessage = null;<br />

Another hitch I couldnt overcome is the ability to create multiple tasks on a workflow. So for every mail sent i wanted to create a task, for each user. Couldnt do that, I tried while loops and experimented fully with the CreateTask class. I assigned correlation tokens and the works. So anyone with more brains than me could maybe let me know how to do that?

over and out!