Slideshow using Content Search Webpart

Off late, I have been working on client side to provide seamless solutions on Online sites.One such requirement was to provide slideshow functionality for machine – mechanical drawings uploaded by the engineering team. Well, the solution seems to be straight – forward : to just use a picture library and configure the timelines.

Nevertheless, the business were desperate to see the title and last-modified date for these images displayed.My initial thought was to use jQuery and customize it accordingly. But , to my surprise this feature was supported by OOTB feature – Content Search Webpart, way to go !

I presume the reader has knowledge creating a new “Result Source” to query the images from the picture library. The query builder in result source has preview to show the query results .

The final step is to add a content search webpart and configure it with the settings below

Capture

Webpart settings

The change query property should now point to the result source created earlier, preview shows the results fetched for the current result source.

Capture

Change query

The end product would be something like below Capture

VisualSP in SharePoint

Well, I was part of governance team who decides the process on smooth operations of SharePoint post its migration to the new system. One of the pain points was to educate the end user on SP 2013.

Switching MOSS to SP 2013 was a drastic change for the user and they were desperately looking for training materials.One of the common approaches is to create KB articles , but again question arises : how often to update , what topics to add/update and how best one can draft the document which may need the expertise of content writers.

Of course, we came up with this approach for L2 support engineers that was effective in the troubleshooting, however there was a separate tooling system that was integrated with SP and known as VisualSP . VisualSP provides loads of materials in the form of videos ,documentations , tips on the ribbon in specific to a SharePoint page.Furthermore, it also offers In-context help content for the end user.

For instance, If a user is on the SiteSettings page, the tool loads all the help topics/videos on ribbon section in relation to the page, i.e : the possible actions/operations that can be performed on the page.

Installation is quite simple that involves installing a package on a WFE server, followed by an option to expose this feature either to all site collections or specific site collections.The feature enabled will furnish loads of contents and I bet users would find this very handy for their daily operations that further can reduce the support tickets for assitance.In addition, the contents can be hidden from few users by managing their permissions at the site collection level.

 

Retain workflow history

In the recent times , I was involved in a migration from MOSS to SP 2013 which involved lot of challenges and learning.Between, one such important activity I would like to share is to retain the workflow history of an item when it is acted upon by the approvers.

The workflow history for an item exist only for a mere 60 days , however it is crucial for business to keep track / audit of the item whose outcome could be either approved or rejected.It becomes a challenge for a developer to tweak this OOTB feature in SharePoint.After spending lot of time investigating we came up with a strategy:

Athough the history is wiped out for an item in the list, the data do still exist in the workflow history list that is hidden by design in SharePoint.

~SiteUrl/lists/Workflow%20History/

The link will take the user to the Workflow History list – a repository of all the history data.One of the ways to track history data of an item is to filter the list by Item based on their ID . This will fetch all the relevant data.

The equivalent URL is :

~SiteUrl/lists/Workflow%20History/Audit%20View.aspx?FilterField1=Item&FilterValue1=ID

Obviously, this does not serve the purpose for the end user as this is not a user friendly solution and I am sure that most the users may not be happy with this.

The workaround would be to add a calculated column to the list and pre-configure it with the URL mentoined above.This will generate a hyperlink for the user to navigate.However, to get a user friendly name it is advised to use something like :

=CONCATENATE(“~SiteUrl/lists/Workflow%20History/Audit%20View.aspx?FilterField1=Item&FilterValue1″,”=”,ID)

You could try the above steps and try for yourselves.

The file is not checked out. You must first check out this document before making changes.

Couple of weeks ago i got a requirement from the customer that the files/documents have to be checked-out by the user before editing it,so that the history can be kept tracked off .Initially my thought was straightforward, i went ahead to the Library settings >Versioning settings and changed the Require Checkout option to ‘Yes’ , this makes sure that the user has to checkout before editing any of the document.

To my surprise, there was a code for uploading files to library and this was unsuccessful after changing the above setting. I was getting exception  : The file is not checked out. You must first check out this document before making changes.Below is the fix.This fix will check out and check-in the file automatically when its uploaded.

1. Check if the require checkout option is true or false.

SPDocumentLibrary has a property called ForceCheckout to get the above set value.

bool bCheckoutRes = myDocumentLibrary.ForceCheckout ;

2. if the option is set to ‘Yes’ ,checkout the file after its been added to the library.

SPFile file = myDocumentLibrary.Files.Add(” “);

if(bCheckoutRes)

{

file.Checkin(“Automatic Checkin”);

file.checkout();

}

3. Now check-in the above checked out file after calling ListItem.Update()

if(bCheckoutRes)

{

file.Checkin(“Checkin file programatically”);

}

Autocomplete suggestion in sharepoint using silverlight client object model

In this article i would like to share with you the implementation of auto-complete suggestion in sharepoint using silverlight control.I have considered  ‘AutoCompleteBox’ control in silverlight and have bounded the ‘Title’ of a sharepoint list.

Here goes the code :

MainPage.xaml

<sdk:AutoCompleteBox Height=”28″ HorizontalAlignment=”Left” Name=”autoCompleteBox1″ VerticalAlignment=”Top” Width=”195″  FilterMode=”Contains”  Grid.Column=”2″  />

MainPage.xaml.cs

ClientContext clientContext = new ClientContext(ApplicationContext.Current.Url);
clientContext.Load(clientContext.Web);
list = clientContext.Web.Lists.GetByTitle(“Sample”);
clientContext.Load(list);
ListItemCollection itemColl = list.GetItems(CamlQuery.CreateAllItemsQuery());
clientContext.Load(itemColl);
clientContext.ExecuteQueryAsync(new ClientRequestSucceededEventHandler(OnSucceed), null);

private void OnSucceed(object sender, ClientRequestSucceededEventArgs args)
{
Dispatcher.BeginInvoke(BindData);
}

private void BindData()
{
List<string>searchItems = new List<string>();

if (itemColl.Count > 0)
{

foreach (ListItem item in itemColl)
{
searchItems.Add(item[Constants.title].ToString());
}
}
autoCompleteBox1.ItemsSource = searchItems;
autoCompleteBox1.Focus()
}

The below screenshot shows the ‘Title’ of the sharepoint list being populated :

Applying theme for silverlight controls

As we know we can create a rich UX using silverlight , i would like to share in this article on “how to apply themes to the silverligh controls“.

1. Download and install silverlight 4 for visual studio 2010, make sure the installtion is successfull.

2. Now Download silverlight 4 toolkit that contains SDK ,some samples, themes and documentations.

3.Navigate to “C:\Program Files (x86)\Microsoft SDKs\Silverlight\v4.0\Toolkit\Apr10” to see the contents of the toolkit.

4.Open the silverlight project and add reference to System.Windows.Controls.Theming.Toolkit.dll from bin folder.

5.Also add reference to the theme that you would like to apply for the controls (In this example i have considered reference to System.Windows.Controls.Theming.TwilightBlue.dll ).

6.Go to MainPage.xaml in the project and include the namespace in the UserControl section of the MainPage.xaml file.

xmlns:ThemeBlue=”clr-namespace:System.Windows.Controls.Theming;assembly=System.Windows.Controls.Theming.TwilightBlue”

7.Now add <ThemeBlue:TwilightBlueTheme> just before <Grid x:Name=”LayoutRoot” Background=”White”> and close the tag after Grid definiton.

Here is an example of the silverlight control(with theme) integrated with sharepoint.

Image