responsive-sharepoint-sites.jpg

Building Responsive SharePoint Sites

Danny Ryan:                       Hi, this is Danny Ryan, and this is the ThreeWill Podcast. Today I’ve got Eric Bowden here with me. Eric is a Principal Consultant for ThreeWill. Did I get that right?

Eric Bowden:                     You got it.

Danny Ryan:                       Awesome. Thank you for taking the time to do this, Eric. I know we are going to talk about an important subject here today, which is how do you do responsive when it comes to SharePoint. I look forward to learning more about how you actually make this happen. Let’s just get this kicked off with what do we need to know to get started with this?

Eric Bowden:                     I think to get started with the responsive design in SharePoint my recommendation is really to start with the requirements. Some folks may decide that, okay, I want the entire SharePoint experience to do Responsive, and may decide that there are only certain pages that I want to be able to render on a mobile device. Because there are only certain things that your mobile user are going to want to do. For example, they’re not going to commonly upload content in SharePoint from their phone.

Danny Ryan:                       Mm-hmm (affirmative), very nice, and so you’re taking a look at those requirement, and then maybe talk me through the first could of steps that you want to start thinking about.

Eric Bowden:                     Yup, so once you have an idea of where you’re headed with your responsive design or a.k.a. supporting mobile and tablet devices in SharePoint, so once you have an idea of where you’re going, you’re going to start into planning the implementation phase. At the highest level what you’re going to need to do in SharePoint is really disable SharePoint’s default handling for mobile devices.

Out of the box, SharePoint includes a feature that’s a mobile redirection site collection scope feature, and what it does is redirects mobile browsers to what is really a constrained presentation of the SharePoint site pages. You’re going to need to disable that, because if you don’t and you create a mobile design, it will really ultimately ignore your mobile design. It will just go to that redirection page.

Danny Ryan:                       Is this the same, I remember you usually could do like slash mobile, and it would bring you to a page?

Eric Bowden:                     Yup, yup, very similar.

Danny Ryan:                       Got you.

Eric Bowden:                     Same thing. Another aspect of SharePoint when people are thinking mobile, and Responsive is a new feature in SharePoint 2013 called device channels. Device channels allow you to target specific master pages and CSS for specific devices. What you do is you configure a master page in CSS for specific user agent strings, which are presented.

This is different than a responsive design. Responsive design is one where the site is really built to present itself on a variety of screen sizes, so as the SharePoint site shrinks up for say a tablet, or a mobile phone, it’s actually morphing. It’s changing as the screen size reduces, and that’s different than device channels, which are really discreet, specific experiences for specific devices.

Danny Ryan:                       Got you, so we disable what’s built in, starting to think about what types of devices we’re trying to target with this?

Eric Bowden:                     That’s right. Yeah, and that is important. On a recent project that I worked on, we decided that we would target, of course desktop, and then you’re targeting tablet and mobile phones. We chose to go try and find the extremes, so on the mobile phone you’re thinking … We targeting the iPhone 4, because that’s the smallest screen size, in the middle were tablets. You have to keep in mind that tablets are both landscape and portrait, so those may have a different experience. Your contents going to run separately, and then of course desktop.

Danny Ryan:                       Got you, so once you’ve disabled it, and you’re starting to make some changes, what are some of the technologies involved with this? Any further steps we need to make to get ready for this?

Eric Bowden:                     Yes. It’s good at this point to think about or to be aware of what is going to be changed in your SharePoint environment. What are the scope of appdev changes that I’m going to make in the SharePoint environment to support responsive design? Those are not entirely limited to, but include master page updates. Unlike the device channels, you’re not going to have a number of master pages, you’re going to have one master page. There’s also going to be layout pages, changes to those. I highly recommend the use of publishing sites with layout pages versus team sites with web part pages. The reason for that is because it’s a lot easier for us to change the layout of a layout page than it is a web part page.

Danny Ryan:                       Got you.

Eric Bowden:                     On our most recent project 99% of the sites were publishing sites with layout pages. Now we did have some team sites. I’ll talk a little bit later about some of the ways you can poke into those, and continue to make those responsive. The third piece that you’re going to be updating of course are CSS. Really what you’re going to be doing there is overriding in large part CSS styles that are provided by default from SharePoint.

Danny Ryan:                       Got you. Let me back up here just a second, whereas, as far as we’ve said you use SharePoint in general. We’re talking about on-premise … I guess there’s a couple different versions that we’re dealing with. I know it depends on the project, but you’re focusing primarily on a SharePoint 2013 on-premise is that typically what we’re dealing with?

Eric Bowden:                     It could really be either one from a technology standpoint. The most recent project that I’m referring to was an on-premise version of SharePoint 2013. These changes could be made in Office 365, the only caveat to that is you do need to be aware of Microsoft’s guidance for upgrades. They may push an upgrade out at any time. If you have your own master page, you made a copy, and now you’re using your own master page, and any updates to master pages that they may have pushed out, you’re going to miss those. The ideal case-

Danny Ryan:                       As soon as you do a custom master page, then that’s the one you move forward with, and if they make any changes, you don’t get those changes.

Eric Bowden:                     You don’t get those.

Danny Ryan:                       Shut the front door.

Eric Bowden:                     Right. They will have upgraded the default master page for that publishing site. In SharePoint online our recommendation is if at all possible, keeping that master page the same, you’re more focusing on CSS updates. You’re more focusing on something that can be accomplished through a theme. You’re a little bit more limited, but you’re being more friendly to the free upgrades that come with Office 365.

Danny Ryan:                       Have you talked at all about Bootstrap and jQuery?

Eric Bowden:                     Yeah, Bootstrap-

Danny Ryan:                       I’m going to bring this up like I know what I’m talking about.

Eric Bowden:                     That’s good, that’s good. It sounds like you do. When we talk responsive and mobile, Bootstrap is usually the first thing that come to mind. Bootstrap is the first place to start with making a SharePoint site responsive. For those who aren’t familiar with Bootstrap, the good news is you don’t have to become an expert with it to be productive. There are many simple features that are provided in Bootstrap. The simplest is is describing that Bootstrap is designed to provide a 12 column layout for your site. Imagine that you’re looking at a desktop presentation of your site, and imagine dividing it up into 12 columns.

You can combine those columns together. For example, you could have four columns which are really three columns wide each. Then what you’re saying is that for different screen widths, I want those columns to stack on top of each other. As the screen becomes more narrow and you have these say three columns at some point, and you decide what that point is, they stack on top of each other. Bootstrap provides a handful of other handy utilities. You can hide and show certain columns. Let’s say we have a rendering of a web part, which has certain data on it.

Maybe it’s a listing of users, and it has the name, title, I don’t know, phone number, and then for a mobile maybe it’ll just have their name and phone number, and we’ll leave the title off. That’s the simple Bootstrap, and that’s really the best place to start. What you’re going to be doing there is open your master page, add a reference to Bootstrap, and then you’re going to start decorating HTML elements that are in your master page with Bootstrap classes.

Danny Ryan:                       Decorating, how festive.

Eric Bowden:                     Bootstrap, that’s going to get you started. That’s a real quick easy way to get really any site responsive. It’s a lot faster than you might see with a standard asp.net application, but with SharePoint you’re going to have to go a few steps further. The reason for that is because we don’t really have control over everything that’s being rendered. The next step is we’re going to have to get in and override CSS. SharePoint may be saying a column is a specific width.

One of the things that we battled with a lot was the padding, so as the screen width becomes more narrow, we want to constrain that padding between elements to give it a little bit more space. Another aspect are what are called meteor rules. Meteor rules allow us to specify specific CSS attributes for certain screen widths, so that comes into play. Padding is a pretty good example. For desktop widths, maybe we’ll have the default padding, but then for phone widths we’ll constrain that padding.

Danny Ryan:                       Got you, and then jQuery, have you talked about that?

Eric Bowden:                     Yes, so jQuery and JavaScript … I have to admit, that’s not something I was expecting to get into when making a SharePoint site responsive, but it ended up being really a key, and highly useful tool. The net of it is that because we don’t have control over everything that’s being rendered in SharePoint, we use jQuery to select elements that are on the page and maybe add Bootstrap classes. Maybe we’re adjusting the width. jQuery was used to constrain images. Images end up being a challenge, because images will tend to push out the boundaries of an HTML element, so you’ve got to find some way to get those images to constrain, and jQuery and JavaScript is one way to do it.

We had one interesting application of jQuery and JavaScript was with this particular site design we decided … You’re familiar with the quick Launch in SharePoint, that’s on the left hand side of the page normally. For our mobile design, we decided to do two things. Take that quick launch and instead of on the left hand side of the screen, we put it to the top. The second thing we decided was that anything that was in the quick launch, except for sub-sites, would be removed.

What we’re doing there is we’re allowing users who are on a mobile device, we’re saying, “Well, let’s not clutter them up with lists and libraries. We’ll just let them navigate from site-to-site. They can see the home page and dashboard style information that’s on each home page.” That was accomplished with jQuery because we need some of that JavaScript logic to figure out, okay, here’s this link, well, what is it? Is this a sub-site, or is it a list, or a library?

Danny Ryan:                       My goodness. It sounds like there’s things in SharePoint that you’re having to, I call it, fight against and make change around, and then there’s a couple of technologies. Were there certain tools that you were using, like browser tools to go inspect who had control and those types of things? I know I deal with it on our public site, just trying to figure out who’s setting what and digging into that, so are there certain tools that you end up using when you’re doing responsive design with SharePoint?

Eric Bowden:                     Yeah, absolutely. Chrome developer tools is a great place to start. All of the browsers have developer tools, but Chrome is the best one to start with because it has the ability to render for mobile devices. There’s a little icon there, you click and it goes into a mobile view. Then you can actually select from maybe a dozen of different devices. The iPhone is one of them.

Danny Ryan:                       They just change the user agent. Is that what it’s doing?

Eric Bowden:                     It does. It changes the user agent, and it also changes, of course, the screen size to be the appropriate screen size. We found I would say maybe 90% of issues on mobile devices we found through testing with the Chrome developer tools, but highly recommend that folks are sure to have a sampling of the actual devices, preferable across the three major OS’s: iPhone, Android, and Windows phone.

For us, iPhone was the friendliest. We had the fewest issues on that one, or at least the fewest issues that were not discovered through the Chrome developer tools. Android ended up being the second friendliest, and funny enough we had the most issues on Windows phone. You have some issues like one of the basics and fairly easy ones is that on a desktop experience you’re used to the hover, well there’s no hover on your mobile devices. You have to changes those to be click, so they actually touch those things instead of hovering over them.

Danny Ryan:                       For the testing it seems like you want to dedicate some good time towards testing. Did we have somebody come in in particular? Did Brandon come in and help out with the testing for this?

Eric Bowden:                     Yes, so Brandon was a key part definitely in the testing effort. We had him configured with his own local, of course, SharePoint 2013 environment. He had testing across those devices. We had iPads and the Galaxy tablets and so forth. Probably can’t say enough good things about the testing effort there, and really being sure to … You can’t really make assumptions on it, or you can’t make too many assumptions. I’ll put it that way.

Danny Ryan:                       Interesting. Anything to wrap this up at all? Anything more you want to add? Besides, if you’re doing something crazy like doing responsive with SharePoint you should contact us, right?

Eric Bowden:                     Absolutely, absolutely. Yeah, so we’ve been through it a few times, and can definitely save you some time. I think one thing that I’ll add is on this most recent project, having good site analytics and site usage data was really important. It was really important for two reasons. One is constraining the scope of the project, so we can find out what are people really using. If nobody goes to a particular page, let’s not put the work into making it mobile and able.

Now what might end up happening is, and largely it does through your work, the site may end up being mobile and able, because it just is by default of the other work that you’re doing, and of course, lucky you it works. If nobody’s going to that site, recognize that and don’t put the effort into testing it and appdev on a site that nobody’s visiting. The next aspect of having that site-

Danny Ryan:                       I’m sorry to interrupt. What did you use for analytics?

Eric Bowden:                     This site was using Google Analytics.

Danny Ryan:                       Okay, so you had just the embedded in there code and looked at Google Analytics?

Eric Bowden:                     Yup.

Danny Ryan:                       Okay.

Eric Bowden:                     Yeah, and interesting story about that is that there’s a CodePlex project for embedding Google Analytics into SharePoint. These folks have been using it for quite some time and with great results. However, we found an issue with that project, and it only showed itself on Windows phone. We had to make a little update and work around that by taking what was that Google Analytics JavaScript, taking it out of the site collection feature that comes with this Google Analytics solution by default, and adding it ourselves to the master page. That worked around what was really an authentication issue only on Windows phone.

The last thing to mention about Google Analytics or any analytics that you choose, a benefit is that when this project is complete, and you have your launch and you do some marketing around the site, you can find out are people really using this site with their mobile devices, and which pages are they using. Maybe they branched out beyond the site usage patterns that you’d imagine that they would use.

Danny Ryan:                       Cool. Thank you for taking the time to share this. I appreciate your sharing with folks some insights on how to make your SharePoint sites responsive. That’s neat that you mentioned this works for both on-premise and Office 365.

Eric Bowden:                     That’s right.

Danny Ryan:                       That’s very cool.

Eric Bowden:                     Thanks for having me.

Danny Ryan:                       You betcha. Thanks so much for listening. Take care. Bye bye.

read more
Eric BowdenBuilding Responsive SharePoint Sites
check.jpg

Updating the Task Approval Form for the “Out of Box” SharePoint Approval Workflow

I was recently working on a project where the customer wanted to use the default SharePoint Approval workflow, but they wanted to include some additional information on the Task Approval form so that the “approver” did not need to navigate back to the SharePoint Document library to get the key information required to approve or reject the request. In this particular scenario, the customer wanted to add the Vendor name and the Invoice amount fields. Having customized Approval forms in the past that were related to SharePoint custom lists, I thought this would be relatively straightforward; it turns out that the process is a bit different between lists and document libraries.

To get started, you will need to open SharePoint Designer and navigate to the appropriate SharePoint site. Next, navigate to the Workflows folder and make a copy of the Approval – SharePoint 2010 as demonstrated below. SharePoint 2010 workflows run in both 2010 and 2013 environments.

Right-click the Approval-SharePoint 2010 workflow and select Copy and Modify. Add the name of the workflow (in my case, “Demonstrate Custom Columns on Approval Form”) and select the Content Type. In this scenario, I am associating this approval workflow with a custom Document Set content type called Custom Document Set.

After providing the workflow name and associated content type, click OK to save the new workflow. I also recommend publishing the workflow at this point so that it will go ahead and generate the default InfoPath Approval Form. Note that the default name of the InfoPath form will be ugly. I won’t go into detail in this blog, but there are ways to manipulate this name in the associated .xoml and xoml.wfconfig.xml workflow files prior to publishing the workflow so you can have a nicer name.

Having created a copy of the “out of box” Approval workflow and published it, we can now edit the workflow. Click the name of the Approval task as highlighted below.

You will see a Task Form Fields section in the top-right of this screen. Here we want to add two new Task Form Fields by clicking on the New button.

Add a field called Vendor as a single line of text.

Next, add Invoice Amount as Currency.

After completing these steps, publish the Workflow again to persist these changes. This has basically added two new fields to the task content type associated with this Approval workflow.

Next, we need to open up the task approval form and add the new fields. Click on the form name to launch InfoPath where we can edit the form.

After the form opens in InfoPath, right-click the Status column and select Insert Row above.

After the new row has been added, enter the Vendor text in the label column.

Next, in the data area of the form, add the Calculated Value object from the Controls list as demonstrated in the 2 screen shots below.

To see the Calculated Value option, select the small arrow in the bottom of the controls list.

After clicking this arrow, you will see the Calculated Value option as demonstrated below.

Next, select the Vendor field from the Fields list as demonstrated below. This screen shot displays the culmination of having clicked the “fx” button and selected the “Insert Field or Group”. Select the Vendor option.

Repeat these same steps to add the Invoice Amount column to the form. For the Invoice Amount column, you can choose to display the value formatted as currency as show below.

Publish the updates to the form by clicking the blue “up arrow” in the top of the InfoPath form.

Allow InfoPath to save a local copy as part of the Publish process as shown below.

You should receive a message indicating the Publish was successful.

At this point, Publish the workflow again so that the updates to the InfoPath form are saved with the Workflow.

Now that we have added fields to the task content type and updated our InfoPath form to display those fields from the task content type, we need to populate those task fields within the workflow.

Edit the Workflow and click the Approval task name as demonstrated below.

Next, select the “Change the behavior of a single task” option.

In the “Before a Task is Assigned” section, add a “Set Task Field” action. Select the Vendor field from the list of Task fields and select the Current Item: Vendor field from the fields displayed in the Current Item. Basically this is populating the Task field called Vendor with the Vendor value from the Current Item before creating the Task. Repeat the same steps for the Invoice Amount field.

Publish the workflow again to persist the changes to the workflow.

Now when you run the workflow and an Approver opens up the Task Approval form, they will see the new Vendor and Invoice Amount fields populated which will help them decide to Approve or not.

One limitation of this solution to point out is that the values on the Task Approval Form are captured at the time the workflow runs and are not dynamic. So, if these values are changed in the document library, the changes will not be shown in this form. The rule of thumb should be that any changes to the underlying data in the document library should prompt any running Approval Workflows to be cancelled and a new one started. This would make sense since approvers in a multi-step approval process may have already approved based on the original values.

read more
Tim CoalsonUpdating the Task Approval Form for the “Out of Box” SharePoint Approval Workflow
red-shoes.jpg

Great and Powerful SPGridView

On a recent project, we needed to display some data from lists which spanned multiple sites within a site collection, but the client wanted the data in the “familiar” SharePoint list format, with sorting and filtering and edit and ECB action capabilities. We explained that collecting the data can easily be done using an SPSiteDataQuery, but displaying the data with the sorting and filtering and familiar “list view” look and feel the users were familiar with, would take a little effort.

The response was, “Well, can’t you just use the list view in SharePoint?”.

Sort of…

SharePoint gives you a great deal out of the box, but it’s sort of like the wizard’s line in the The Wizard of Oz, “Pay no attention to that man behind the curtain.”  That “man” behind the curtain is really busy pulling levers and twisting knobs to make things look really simple.

The thought was that integrating the data and mimicking the look and feel of SharePoint should be easy, right?

The key was how to reuse the power of SharePoint’s out of box features to minimize the amount of coding we needed to do.

Let’s open the curtain and see how we got this accomplished.

Follow the Yellow Brick Road

Our client had a very clear idea of what data they wanted, and how they wanted to interact with that data.  Here are the loose requirements in User Story format (with some of the details cloudy from the poppies):

As a team member I want to display list data for the current site only for top-level sites
As a team member I want to display all data from a non-root site  and all child sites
As a team member I want to edit the displayed fields without leaving the view of all the items
As a team member I want to be able to edit a specific list item by clicking the “Edit” menu for the item
To implement these features, we needed to  query data from multiple lists, assemble the data and enable the ECB menu style interaction with the returned data. Here’s the high level steps required to accomplish the previous features.

Using ObjectDataSource and SPSiteDataQuery to query list data
Creating a Custom People Editor Bound Field
Binding SPGridView to the ObjectDataSource
Providing an ECB Menu using MenuTemplate and SPMenuField
Dealing with the Flying Monkeys
Using ObjectDataSource and SPSiteDataQuery To Query List Data

Many articles and blog posts hint at using the SPDataSource as the datasource to bind to the SPGridView instance.  However, for our purposes, SPDataSource had some shortcomings.  Specifically, the search modes of SPDataSource were insufficient for our scenario.   Using the ObjectDataSource gave us the most flexibility, enabling configuration of Select and Update (we did not implement Insert and Delete) commands to execute on our data, as well as the integration we wanted to keep all of the SharePoint goodness.

One challenge of using  the ObjectDataSource combined with SPSiteDataQuery was providing an SPContext in order to query the correct site and web.  The ObjectDataSource enables this by providing the OnDataSourceCreating event, and wiring this up enables us to provide the SPContext information to an overloaded constructor of our ObjectDataSource.  The following are snippets of the code that initializes the instance of our CustomDataSource and then the handler that lets us use the SPSite and SPWeb we need for querying data.

private void InitDataSource()
{
string assemblyName = typeof(CustomDataSource).AssemblyQualifiedName.ToString();
_dataSource = new ObjectDataSource();
_dataSource.TypeName = assemblyName;
_dataSource.ID = "CustomDataSource";
_dataSource.SelectMethod = "GetDataTable";
_dataSource.UpdateMethod = "UpdateDataTable";
_dataSource.SortParameterName = "sortExpression";
_dataSource.FilterExpression = _filterExpression;
_dataSource.ObjectCreating +=
new ObjectDataSourceObjectEventHandler(OnDataSourceCreating);
_dataSource.Filtering +=
new ObjectDataSourceFilteringEventHandler(OnDataSourceFiltering);
Controls.Add(_dataSource);
}

And here is the handler definition.

private void OnDataSourceCreating(object sender, ObjectDataSourceEventArgs e)
{
SPSite site = SPContext.Current.Site;
SPWeb web = SPContext.Current.Web;
e.ObjectInstance = new CustomDataSource(site, web);
}

Within the GetDataTable method of our CustomDataSource, we dynamically build a CAML query for all Lists of a specific type (by list ID) and use an instance of the SPSiteDataQuery class and SPContext.Site instance to get the DataTable back from our CAML Query.

InitCaml();  //dynamically builds the CAML for our query
_siteDataQuery = new SPSiteDataQuery();
_siteDataQuery.ViewFields = _viewFieldsClauseXml;
_siteDataQuery.Lists = _listsClauseXml;
_siteDataQuery.Webs = _websClauseXml;
_siteDataQuery.Query = _queryClauseXml;</code>

DataTable table = _site.RootWeb.GetSiteData(_siteDataQuery);

We then iterate over the rows in the table and add or modify columns and data to get specific information.  One specific piece of data required was the SPUser that an item was Assigned To (the lists were based on the Task List).   Getting the AssignedTo translated value into the table led into another key feature – binding the row to a list item and enabling the use of the custom PeoplePickerBoundField to bind and update the AssignedTo field.

To enable the Update of a given list item as a postback, the UpdateDataTable method of our CustomDataSource used the SPSite, SPWeb, ListID and ListItemID from our query contained in the DataTable to access the list and update the list item for any SPWeb within the site collection.

Creating a Custom PeopleEditor Bound Field

Since one of the columns we wanted to display for the user to edit was an AssignedTo field, we wanted to enable the field to be bound to a PeopleEditor part.  Well, it turns out that there is no out of the box implementation of a BoundField that will let you bind to an SPUser (at least we couldn’t find one…please comment on this post if there is).  Here’s one of those places to help the wizard and create a custom BoundField implementation.  The following is the most important bit of code in creating the PeopleEditorBoundField:

protected virtual void OnBindingField(object sender, EventArgs e)
{
Control control = (Control)sender;
//if we are in view mode
if (control is TableCell)
{
((TableCell)control).Text = GetValueForView(control.NamingContainer);
}
else if (control is PeopleEditor)
{
PeopleEditor peopleEditor = (PeopleEditor)control;
peopleEditor.Visible = true;
peopleEditor.AllowEmpty = true;
peopleEditor.MultiSelect = false;
peopleEditor.Width = Unit.Pixel(200);
peopleEditor.SelectionSet = "User";
ArrayList entityArrayList = new ArrayList();
PickerEntity entity = new PickerEntity();
entity.Key = GetValueForEdit(control.NamingContainer);
entity = peopleEditor.ValidateEntity(entity);
entityArrayList.Add(entity);
peopleEditor.UpdateEntities(entityArrayList);
}
}

For details on creating a custom BoundField, see the Notes and Links below.

Binding SPGridView to the ObjectDataSource

Now that we have the data in a DataTable by using our CustomDataSource, and our custom PeopleEditorBoundField that we bind user information to, we need to display the data. The SPGridView inherits from GridView, and so gives you all of the crunchy goodness of the GridView with the standard rendering of  the SharePoint styled grid in the browser.  We just configured the SPGridView and enabled the options needed, like the data source, sorting and filtering and our columns to display.  Below are some of the more interesting bits of initializing the SPGridView instance in our case.

//we're going to identify the columns we want
<span style="font-family: monospace;">_spGridView.AutoGenerateColumns = false; </span>

//we'll wire our own in the InitBoundColumns
_spGridView.AutoGenerateEditButton = false; 

//we'll use this later to mimic the ECB menu
_spGridView.DataKeyNames = new string[] { "WebId", "ID" }; 

...

//enable sorting
_spGridView.AllowSorting = true; 

//enable filtering, we also set the&nbsp;FilterDataFields property
_spGridView.AllowFiltering = true;

...

//set the event handlers for the sorting and binding
_spGridView.Sorting += new GridViewSortEventHandler(OnGridViewSorting);
_spGridView.RowDataBound += new GridViewRowEventHandler(OnGridViewRowDataBound);

One interesting aspect of using the SPGridView with the ObjectDataSource is that you must specify the DataSourceID when using the ObjectDataSource.  This is required since the underlying calls find the DataSourceControl by the parent NamingContainer and the DataSourceID properties.

//must set DataSourceID in order to use the ObjectDataSource binding
_spGridView.DataSourceID = "CustomDataSourceID";

Providing an ECB Menu Using MenuTemplate and SPMenuField

Finally, we needed the ability for the user to view or edit a list item directly by the use of ECB menu style actions.  To do this, while building the columns for our grid view, we simply use the MenuTemplate and SPMenuField classes to build a menu that has links and custom actions for our list items (code modified to cleanse some specifics).

//construct and add the Title MenuTemplate
MenuTemplate itemMenuTemplate = new MenuTemplate();
itemMenuTemplate.ID = "ItmeTemplateID";

//construct and add the Item Title MenuField
SPMenuField itemMenuField = new SPMenuField();
itemMenuField.HeaderText = _displayColumnName;
itemMenuField.TextFields = _internalColumnName;
itemMenuField.MenuTemplateId = "ItmeTemplateID";
itemMenuField.ToolTipFields = ...; &nbsp;//string[] of fields for tool tips
itemMenuField.ToolTipFormat = ...; &nbsp;//format stringfor tool tips
itemMenuField.NavigateUrlFields = ...;
itemMenuField.NavigateUrlFormat = ...;//dynamically built url with token replacement
itemMenuField.TokenNameAndValueFields = "WEB=WebId,ID=ID";
itemMenuField.SortExpression = "Title";

//construct and add the Items Title MenuItem
MenuItemTemplate editItemMenuTemplate = new MenuItemTemplate...;
//dynamically built url with token replacement
editItemMenuTemplate.ClientOnClickNavigateUrl = ...;
itemMenuTemplate.Controls.Add(editItemMenuTemplate);
this.Controls.Add(itemMenuTemplate);
_scopingGridView.Columns.Add(itemMenuField);

//Custom bound PeopleEditor field
PeopleEditorBoundField assignedToColumn = new PeopleEditorBoundField();
assignedToColumn.ShowHeader = true;
assignedToColumn.HeaderText = _displayPersonColumnName;
assignedToColumn.DataField = _internalPersonColumnName;
assignedToColumn.SortExpression = _internalPersonColumnName;
_spGridView.Columns.Add(assignedToColumn);

This gives us a link to the list item like the standard SharePoint List with the Title column as a link, a menu with a link to the EditForm.aspx page for the specific list item, and our custom PeopleEditor bound field.

Dealing With the Flying Monkeys

One of the special requirements was to enable a RootWeb to retrieve all of the data for all webs recursively, but to initially filter the data to the RootWeb list items. So far everything was going smoothly, a webpart, a custom ObjectDataSource and a custom BoundField, easy-peasy.

Well, you knew the flying monkeys had to show up at some point to make slow us down, right?

The most difficult issue in this process was attempting to get the SPGridView to be filtered automatically on page load. Turns out that there are properties that the SPGridView uses to determine and pass the FilterExpression to the ObjectDataSourceView.CreateFilteredDataView() instance in order to filter the data to render to the user.

Well, you might think this should be exposed as a property or method, but the SetFilterField and SetFilterValue properties are private.  This time the “curtain” was lifted by .NET Reflector.   Turns out, the private methods in SPGriedView set the ViewState entries for the FilterFieldName and FilterFieldValue keys respectively.   Using this knowledge, getting the filtering to be applied immediately on page load was a matter of ensuring that the “filterFieldName” and “filterFieldValue” attributes were applied before the grid was rendered by the following:

if (Page.IsPostBack &amp;&amp; !string.IsNullOrEmpty(_filterExpression))
{
_spGridView.Attributes["filterFieldName"] = _filterExpression.Split('=')[0].Trim();
_spGridView.Attributes["filterFieldValue"] = _filterExpression.Split('=')[1].Trim();
}

Putting It All Together

Once the pieces were all in place, wiring this all together was amazingly simple. To recap, we created a custom web part wrapping the SPGridView, created a custom ObjectDataSource and used the SPSiteDataQuery to query across webs and lists, and bound the SPGridView to the ObjectDataSource.  Finally we configured our SPGridView to use a standard and custom BoundFields to display, edit and persist  list item changes.  Here is the web parts CreateChildControls method:

protected override void CreateChildControls()
{
InitGridView(); &nbsp;//set up the grid view for filtering and sorting and events
InitBoundColumns(); &nbsp;//initialize the bound columns
InitDataSource(); &nbsp;//initialize the custom ObjectDataSource
//must set DataSourceID in order to use the ObjectDataSource binding
_spGridView.DataSourceID = "CustomDataSourceID";
Controls.Add(_spGridView);
}
//It is best to databind in the Render method since this
//is after all other sorting and filtering flags have been set
protected override void Render(System.Web.UI.HtmlTextWriter writer)
{
base.Render(writer);
_spGridView.DataBind();
}

This gave our users the familiar look and feel of the lists in SharePoint, let the users sort and filter the list, and even bound that data in the rows to enable in-place updates of list items that spanned multiple sites (webs) and lists.

Notes and Links

While determining how to solve this issue, we used the following links and resources.  Thanks to all of these authors for pointing us in the right direction and easing the time to implement.  Hopefully someone can use this post’s information the same way.

http://blogs.msdn.com/b/sharepointdesigner/2007/04/24/spdatasource-and-rollups-with-the-data-view.aspx
http://msdn.microsoft.com/en-us/library/dx70zk47(v=VS.100).aspx
http://msdn.microsoft.com/en-us/magazine/cc163673.aspx

read more
Pete SkellyGreat and Powerful SPGridView
blog.jpg

Automating Service Requests

ThreeWill wrote a blog post for the Microsoft SharePoint Product Team Blog on building a generic Service Request Office Business Application (OBA) using InfoPath Forms Services.

Overview

Today’s guest blog post is from ThreeWill, a Microsoft Managed Gold Partner located in Alpharetta, Georgia that focuses on SharePoint development and integration. ThreeWill recently worked with Microsoft to build a generic Service Request Office Business Application (OBA) using InfoPath Forms Services. The application addresses the need for enterprises to have a no-code way to quickly turn around service request based SharePoint sites (i.e. sites that are using electronic forms to initiate a request and tie that request to a workflow).

Some Service Request examples are:

      Request for Marketing Funds

 

      Request for Laptops or other equipment

 

    Request for Project Site Creation

The solution is packaged up as a SharePoint Feature to enable deployment to a Server Farm and standard SharePoint provisioning. The application supports integration with Active Directory to pre-populate user information and provides easy access to Web Services from InfoPath using Data Connections. Finally, configuration information is stored in a SharePoint List for secure yet convenient access to Site Administrators. Over to ThreeWill on how they did it.

Pej Javaheri, SharePoint Product Manager.

Read the full post at the Microsoft SharePoint Team Blog – http://sharepoint.microsoft.com/blog/Pages/BlogPost.aspx?pID=542


SharePoint is a web application platform in the Microsoft Office server suite. Launched in 2001, SharePoint combines various functions which are traditionally separate applications: intranet, extranet, content management, document management, personal cloud, enterprise social networking, enterprise search, business intelligence, workflow management, web content management, and an enterprise application store. SharePoint servers have traditionally been deployed for internal use in mid-size businesses and large departments alongside Microsoft Exchange, Skype for Business, and Office Web Apps; but Microsoft’s ‘Office 365’ software as a service offering (which includes a version of SharePoint) has led to increased usage of SharePoint in smaller organizations.

While Office 365 provides SharePoint as a service, installing SharePoint on premises typically requires multiple virtual machines, at least two separate physical servers, and is a somewhat significant installation and configuration effort. The software is based on an n-tier service oriented architecture. Enterprise application software (for example, email servers, ERP, BI and CRM products) often either requires or integrates with elements of SharePoint. As an application platform, SharePoint provides central management, governance, and security controls. The SharePoint platform manages Internet Information Services (IIS) via form-based management tooling.

Since the release of SharePoint 2013, Microsoft’s primary channel for distribution of SharePoint has been Office 365, where the product is continuously being upgraded. New versions are released every few years, and represent a supported snapshot of the cloud software. Microsoft currently has three tiers of pricing for SharePoint 2013, including a free version (whose future is currently uncertain). SharePoint 2013 is also resold through a cloud model by many third-party vendors. The next on-premises release is SharePoint 2016, expected to have increased hybrid cloud integration.

Office 365 is the brand name used by Microsoft for a group of software plus services subscriptions that provides productivity software and related services to its subscribers. For consumers, the service allows the use of Microsoft Office apps on Windows and OS X, provides storage space on Microsoft’s cloud storage service OneDrive, and grants 60 Skype minutes per month. For business and enterprise users, Office 365 offers plans including e-mail and social networking services through hosted versions of Exchange Server, Skype for Business Server, SharePoint and Office Online, integration with Yammer, as well as access to the Office software.

After a beta test that began in October 2010, Office 365 was launched on June 28, 2011, as a successor to Microsoft Business Productivity Online Suite (MSBPOS), originally aimed at corporate users. With the release of Microsoft Office 2013, Office 365 was expanded to include new plans aimed at different types of businesses, along with new plans aimed at general consumers wanting to use the Office desktop software on a subscription basis—with an emphasis on the rolling release model.

read more
Pete SkellyAutomating Service Requests
form.jpg

Form Button Disabled

Recently I needed to disable a SharePoint Form’s Submit button until a checkbox on the form was checked. Sounds pretty simple and straightforward, doesn’t it? Well, here’s a little description of why it was NOT so easy for me to do this. The form required a user to indicate that they understood what they were submitting in a form, a sort of consent checkbox, by checking a check box which toggled the Submit button’s Disabled property. And finally, the initial state of the SaveButton should be disabled.

You might be saying (in your best Fletch voice),

“Awww, come on Pete, it’s so simple. Maybe you need a refresher course?”

Just set Disabled on the button control to false, add some JavaScript to toggle the Enabled property when the user checks or unchecks the CheckBox control. Silly me, I thought the same thing. I’ll just disable the underlying Button control using the TemplateContainer.FindControl to find the Button control and set the Disabled property to true. Well, apparently the “ASP.NET runtime will not recognize a post back initiated by a disabled button“. So, my first attempt at simply disabling the Button control in the SaveButton template failed miserably. The JavaScript to control the toggle worked great, but the Submit button, being disabled when rendered, would never submit, even when Disabled was false on the client.

The short answer to the problem, which took me a little longer to figure out, is to use Page.ClientScript.RegisterClientScriptBlock to register a script that will run when the page is loaded and set Button.Disabled to true. The trick here is that SharePoint registers it’s _spBodyOnLoadWrapper function, found in C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS\1033\INIT.JS, to load scripts added to the _spBodyOnLoadFunctionNames array. Once your code loads a function into the _spBodyOnLoadFunctionNames and the page starts to load, the page onload event is handled by SharePoint’s _spBodyOnLoadWrapper function which then calls the list of functions listed in the _spBodyOnLoadFunctionNames array.

To solve my problem, I simply had to create a script which would be called when the check box was checked or unchecked, and add that same function to the _spBodyOnLoadFunctionNames array to be called when the page onload event was handled by SharePoint. Here they are.

string CONSENT_SCRIPT_BLOCK = @"function validateConsentChecked(checkBoxID,
submitButtonID)\\

 

{
var consentCheckBox = document.getElementById(checkBoxID);
var submitButton = document.getElementById(submitButtonID);
submitButton.disabled = !consentCheckBox.checked;
}

 

string DISABLE_SUBMIT_SCRIPT_BLOCK = "_spBodyOnLoadFunctionNames.push(\"validateConsentChecked('{0}','{1}')\")";

To register the function itself, I used the following code:

Page.ClientScript.RegisterStartupScript(this.GetType(), "ValidateSubmission",
CONSENT_SCRIPT_BLOCK, true);

And to register the onload function call, I used this code:

\\
Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "DisableSubmitButton",
string.Format(DISABLE_SUBMIT_SCRIPT_BLOCK, checkBoxID, submitButtonID), true);
\\

Hopefully this will help someone else out in the future and save you some time. If anyone has a different way to handle this problem, let me know. I am more than willing to do away with writing JavaScript if I don’t have to.

read more
Pete SkellyForm Button Disabled
tips-white-e1425575645901.jpg

Web Part Page Maintenance

The Web Part Page Maintenance page is where you can go to see all the web parts included in a web page and perform some limited maintenance activities. To get there, simply append ?Contents=1 to the URL of the page (ex: http://somewhere.com/Pages/Default.aspx?Contents=1). The page which appears lists all the web parts which are included on the page. From there you can choose to remove (Delete) web parts or remove personalization (Reset) for specific web parts. Personalization can be removed for all users (the default) or you can switch to personal view and remove personalization for just the current user.

This SharePoint feature is really handy if one of your web parts is throwing an error preventing you placing the page in Edit Mode. In this case, you can use the Web Part Page Maintenance page to remove the offending web parts.

Thanks to coworkers Kirk Liemohn and Chris Edwards for this great tip!


SharePoint is a web application platform in the Microsoft Office server suite. Launched in 2001, SharePoint combines various functions which are traditionally separate applications: intranet, extranet, content management, document management, personal cloud, enterprise social networking, enterprise search, business intelligence, workflow management, web content management, and an enterprise application store. SharePoint servers have traditionally been deployed for internal use in mid-size businesses and large departments alongside Microsoft Exchange, Skype for Business, and Office Web Apps; but Microsoft’s ‘Office 365’ software as a service offering (which includes a version of SharePoint) has led to increased usage of SharePoint in smaller organizations.

While Office 365 provides SharePoint as a service, installing SharePoint on premises typically requires multiple virtual machines, at least two separate physical servers, and is a somewhat significant installation and configuration effort. The software is based on an n-tier service oriented architecture. Enterprise application software (for example, email servers, ERP, BI and CRM products) often either requires or integrates with elements of SharePoint. As an application platform, SharePoint provides central management, governance, and security controls. The SharePoint platform manages Internet Information Services (IIS) via form-based management tooling.

Since the release of SharePoint 2013, Microsoft’s primary channel for distribution of SharePoint has been Office 365, where the product is continuously being upgraded. New versions are released every few years, and represent a supported snapshot of the cloud software. Microsoft currently has three tiers of pricing for SharePoint 2013, including a free version (whose future is currently uncertain). SharePoint 2013 is also resold through a cloud model by many third-party vendors. The next on-premises release is SharePoint 2016, expected to have increased hybrid cloud integration.

Office 365 is the brand name used by Microsoft for a group of software plus services subscriptions that provides productivity software and related services to its subscribers. For consumers, the service allows the use of Microsoft Office apps on Windows and OS X, provides storage space on Microsoft’s cloud storage service OneDrive, and grants 60 Skype minutes per month. For business and enterprise users, Office 365 offers plans including e-mail and social networking services through hosted versions of Exchange Server, Skype for Business Server, SharePoint and Office Online, integration with Yammer, as well as access to the Office software.

After a beta test that began in October 2010, Office 365 was launched on June 28, 2011, as a successor to Microsoft Business Productivity Online Suite (MSBPOS), originally aimed at corporate users. With the release of Microsoft Office 2013, Office 365 was expanded to include new plans aimed at different types of businesses, along with new plans aimed at general consumers wanting to use the Office desktop software on a subscription basis—with an emphasis on the rolling release model.

read more
Eric BowdenWeb Part Page Maintenance
sourcecode.jpg

SharePoint Picture Library URLs

I recently created a web part for a client that shows a slide show from a picture library using the Slide Show Extender from ASP.NET AJAX Control Toolkit. This requires creating a web service that returns an array of slides, each of which has a URL to a picture.

Amazingly, the most time consuming part of this was determining the URL for a thumbnail image from a picture in a picture library. There may have been a better resource, but I found the hints I needed here: http://msdn2.microsoft.com/en-us/library/ms413130.aspx.

Since this was painful enough, I thought I would post my solution so that others may benefit. Below is the source needed to get the URL for the full image, the larger size (the one you see when viewing or editing an individual picture library item), or the thumbnail size.

using Microsoft.SharePoint;
using Microsoft.SharePoint.Utilities;

public enum ImageSize
{
Thumbnail,
Large,
Full
}
///
/// Provides the url to a picture provided the picture library list item.
///

/// /// ///
///
/// Ugly, but see: http://msdn2.microsoft.com/en-us/library/ms413130.aspx –
there doesn’t seem to be a better way.
///

public static string GetPictureUrl(SPListItem listItem, ImageSize imageSize)

{
StringBuilder url = new StringBuilder();
// Build the url up until the final portion
url.Append(SPEncode.UrlEncodeAsUrl(listItem.Web.Url));
url.Append(‘/’);
url.Append(SPEncode.UrlEncodeAsUrl(listItem.ParentList.RootFolder.Url));
url.Append(‘/’);

// Determine the final portion based on the requested image size
string filename = listItem.File.Name;
if (imageSize == ImageSize.Full)
{
url.Append(SPEncode.UrlEncodeAsUrl(filename));
}
else
{
string basefilename = Path.GetFileNameWithoutExtension(filename);
string extension = Path.GetExtension(filename);
string dir = (imageSize == ImageSize.Thumbnail) ? “_t/” : “_w/”;
url.Append(dir);
url.Append(SPEncode.UrlEncodeAsUrl(basefilename));
url.Append(SPEncode.UrlEncodeAsUrl(extension).Replace(‘.’, ‘_’));
url.Append(“.jpg”);
}
return url.ToString();
}

read more
Kirk LiemohnSharePoint Picture Library URLs
copy-e1425586355402.jpg

Web Part Page Templates

Recently one of my peers at work came across an MSDN article that described how to expose a “custom template” in SharePoint 2003 (http://msdn2.microsoft.com/en-us/library/ms916835.aspx). I was able to follow these instructions using WSS 2007 and was able to expose my custom template in a list of available templates.  The solution involves modifying a shared page in the layouts folder (_layouts/create.aspx) as well as making a custom copy of an existing page ( _layouts/spfc.aspx).

Lastly, you need to copy your template and an image of your template to the SMARTPGS folder (C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\1033\STS\DOCTEMP\SMARTPGS) and associated images folder (C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\IMAGES).


SharePoint is a web application platform in the Microsoft Office server suite. Launched in 2001, SharePoint combines various functions which are traditionally separate applications: intranet, extranet, content management, document management, personal cloud, enterprise social networking, enterprise search, business intelligence, workflow management, web content management, and an enterprise application store. SharePoint servers have traditionally been deployed for internal use in mid-size businesses and large departments alongside Microsoft Exchange, Skype for Business, and Office Web Apps; but Microsoft’s ‘Office 365’ software as a service offering (which includes a version of SharePoint) has led to increased usage of SharePoint in smaller organizations.

While Office 365 provides SharePoint as a service, installing SharePoint on premises typically requires multiple virtual machines, at least two separate physical servers, and is a somewhat significant installation and configuration effort. The software is based on an n-tier service oriented architecture. Enterprise application software (for example, email servers, ERP, BI and CRM products) often either requires or integrates with elements of SharePoint. As an application platform, SharePoint provides central management, governance, and security controls. The SharePoint platform manages Internet Information Services (IIS) via form-based management tooling.

Since the release of SharePoint 2013, Microsoft’s primary channel for distribution of SharePoint has been Office 365, where the product is continuously being upgraded. New versions are released every few years, and represent a supported snapshot of the cloud software. Microsoft currently has three tiers of pricing for SharePoint 2013, including a free version (whose future is currently uncertain). SharePoint 2013 is also resold through a cloud model by many third-party vendors. The next on-premises release is SharePoint 2016, expected to have increased hybrid cloud integration.

Office 365 is the brand name used by Microsoft for a group of software plus services subscriptions that provides productivity software and related services to its subscribers. For consumers, the service allows the use of Microsoft Office apps on Windows and OS X, provides storage space on Microsoft’s cloud storage service OneDrive, and grants 60 Skype minutes per month. For business and enterprise users, Office 365 offers plans including e-mail and social networking services through hosted versions of Exchange Server, Skype for Business Server, SharePoint and Office Online, integration with Yammer, as well as access to the Office software.

After a beta test that began in October 2010, Office 365 was launched on June 28, 2011, as a successor to Microsoft Business Productivity Online Suite (MSBPOS), originally aimed at corporate users. With the release of Microsoft Office 2013, Office 365 was expanded to include new plans aimed at different types of businesses, along with new plans aimed at general consumers wanting to use the Office desktop software on a subscription basis—with an emphasis on the rolling release model.

read more
Tim CoalsonWeb Part Page Templates
digg1-e1425586232963.jpg

Digg Your SharePoint Blog

Not sure? Please take a look at the Digg and Delicious sites and search on Google to learn more. The primary purpose for adding these links is to help generate traffic to your blog content.

If you want to update your existing SharePoint blog site or prepare for future blog sites to include these links, please read on…

This blog post is based on the content from http://techwrap.blogspot.com/2006/03/guide-how-to-add-diggit-and-delicious.html.

Please see the image below for a sample of what we will be adding:

Here are the steps to add both Digg and Del.icio.us links to all blog entries.

  1. Make a copy of the following file.
  2. “C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\SiteTemplates\Blog\Lists\Post\schema.xml”
  3. Open “C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\SiteTemplates\Blog\Lists\Post\schema.xml” using your favorite text editor.
  4. Refer to the steps below “For Digg.com” or “For Del.icio.us.com”
  5. Once you have completed the steps below for either Digg or Del.icio.us, you will need to perform an IISRESET

You should now be able to provision new SharePoint blog sites and/or use existing SharePoint blog sites and see the “Diggit!” and “Del.icio.us” links under each blog entry.

For Digg.com – Adding the Computed Fields

Copy and Paste the following content below the closing </Field> for the Permalink field and before the <Field Name=”PostedByWithDate” (should be after line 27).

<Field Name=”Diggit” ID=”{3680476B-C9A8-4ebb-AED3-B36587F54B80}” Type=”Computed” ReadOnly=”TRUE” DisplayName=”” Sortable=”FALSE” SourceID=”http://schemas.microsoft.com/sharepoint/v3″ StaticName=”Diggit”>
<FieldRefs>
<FieldRef Name=”ID” />;
<FieldRef Name=”Title” />;
</FieldRefs>
<DisplayPattern>
<HTML><![CDATA[<a href=”]]></HTML>
<HTML><![CDATA[http://digg.com/submit?phase=3&amp;url=]]></HTML>
<HttpVDir CurrentWeb=”TRUE” ><HTML> <![CDATA[/$Resources:core,lists_Folder;/$Resources:core, blogpost_Folder;/Post.aspx?ID=]]></HTML>
<Column Name=”ID” URLEncode=”TRUE” />
<HTML><![CDATA[&amp;title=]]></HTML>
<Field Name=”Title” />
<HTML><![CDATA[“>DiggIt!</a>]]></HTML>
</DisplayPattern>
</Field>

Adding the new Computed Fields to all of the Blog Views

Copy and Paste the following content below the closing </Case> for the Permalink field and before the <Case Value=”EmailPostLink”….

<Case Value=”Diggit”>

<Field />

</Case>

Adding the FieldRefs to all of the Blog Views

Copy and Paste the following content below the closing </FieldRef> for the Permalink field and before the <FieldRef Name=”EmailPostLink”>

<FieldRef Name=”Diggit”>

</FieldRef>

 

For Delicious.com – Adding the Computed Fields

Copy and Paste the following content below the closing </Field> for the Permalink field and before the <Field Name=”PostedByWithDate” (should be after line 27).

<Field Name=”Delicious” ID=”{90CFE45B-4101-4bdf-9B58-5D2A663BE7D0}” Type=”Computed” ReadOnly=”TRUE” DisplayName=”” Sortable=”FALSE” SourceID=”http://schemas.microsoft.com/sharepoint/v3″ StaticName=”Delicious”>
<FieldRefs>
<FieldRef Name=”ID” />
<FieldRef Name=”Title” />
</FieldRefs>
<DisplayPattern>
<HTML><[CDATA[<a href=”]]&></HTML>
<HTML><![CDATA[http://del.icio.us/post?url=]]></HTML>
<HttpVDir CurrentWeb=”TRUE” /><HTML> <![CDATA[/$Resources:core,lists_Folder;/$Resources:core, blogpost_Folder;/Post.aspx?ID=]]></HTML>
<Column Name=”ID” URLEncode=”TRUE” />
<HTML><![CDATA[&amp;title=]]></HTML>
<Field Name=”Title” />
<HTML><![CDATA[“>Del.icio.us</a>]]></HTML>
</DisplayPattern>
</Field>

Adding the new Computed Fields to all of the Blog Views

 

Copy and Paste the following content below the closing </Case> for the Permalink field and before the <Case Value=”EmailPostLink”….

<Case Value=”Delicious”>

<Field />

</Case>

Adding the FieldRefs to all of the Blog Views

 

Copy and Paste the following content below the closing </FieldRef> for the Permalink field and before the <FieldRef Name=”EmailPostLink”>

<FieldRef Name=”Delicious”>

</FieldRef>

read more
Chris EdwardsDigg Your SharePoint Blog
calendars.jpg

Aggregating SharePoint Events

One of the requirements that we have received from our customers building Intranet Portals is the ability to aggregate data to the Home site from Calendars and Announcements that “live” on child sites such as HR and IT. Obviously, one way to accomplish this would be to create Announcements and Calendars lists on the Home site and post duplicate entries to these lists when entries are created in the Calendar and Announcement lists in HR and IT. Of course this is not a very efficient way to do things and has a greater chance of data entry errors.

Using MOSS and the Content Query Web Part, aggregating data from lists located in child sites is now possible without the need for unnecessary duplication.

To leverage this capability in MOSS, first make sure the Content Query Web Part shows up in your list of available Web Parts. If not, you likely need to turn on the Office SharePoint Server Publishing feature on the site by going to Site Actions, Site Settings, Site Features and activating the Office SharePoint Server Publishing feature as demonstrated below:

Click activate. Under normal circumstances, the screen will refresh and you will notice the blue “Active” indicator next to the feature. However, in some cases, you might see the screen below which indicates an additional step is necessary.

To install the Office SharePoint Server Publishing Infrastructure, navigate to the site collection. Select Site Actions, Site Settings, Site Collection Features to see the following screen.

Choose to Activate the Office SharePoint Server Publishing Infrastructure feature for the site collection. The screen shot below demonstrates a successful activation.

Now that the Office SharePoint Server Publishing Infrastructure is in place, you can now activate the Office SharePoint Server Publishing feature by navigating to the Site Collection, selecting Site Actions, Site Features and then activating the Office SharePoint Server Publishing feature as demonstrated below.

After selecting Activate for the Office SharePoint Server Publishing feature, you should see the screen below

Now that the Content Query Web Part is available, you can add the Content Query Web Part to a page by navigating to a site, clicking Site Actions, edit page and then selecting Add a Web Part in one of the Web Part zones as shown below.

After you click, Add a Web Part, you will see the following dialog where you can scroll down and click the Content Query Web part

Now that you have successfully added the Content Query Web Part to a Web Part page, you can quickly see content from child sites on the Home Page by updating the Query configuration in the Web Part properties page. However, by default, the number of fields you have access to and the ability to alter the display and styling of this data is severely limited without applying some customization. The good news is that George Perantatos does a great job of describing these steps in detail, so I will merely point you to the ECM blog for these details http://blogs.msdn.com/ecm/archive/2006/10/25/configuring-and-customizing-the-content-query-web-part.aspx.

In addition, Heather Solomon, SharePoint MVP, provides more detailed instructions on creating a new style which can be found at http://www.heathersolomon.com/blog/articles/CustomItemStyle.aspx.

Now that I can view Calendar and Announcement data from child sites, I want to provide the content authors more control over the data that gets displayed on the Home site as well as some control over the duration that the data is displayed. To accomplish this, I add 3 new Columns to each list; Display on Home Page (Yes/No), Display Start Date (Date and Time) and Display End Date (Date and Time). These fields allow content authors to determine if they want this content to “bubble up” to the Home site and, if so, what dates to display this data. To make use of these fields in the Content Query Web Part query, I navigate back to the Content Query Web Part and update the filter section under the Query Properties to leverage these fields as shown below.

This wraps up the basics of aggregating Calendar and Announcement data using the Content Query Web Part. I hope you find this post helps stimulate some ideas for you to add value to your organization or customer.

read more
Tim CoalsonAggregating SharePoint Events