June 27, 2016

SharePoint Survey List returns only 30 items while exporting to spreadsheet.

While working with SharePoint Survey List and modifying items, we have encountered the following issue: When a user uses the “Export to Spreadsheet” function offered by SharePoint for Survey List, is not allowed to export more than 30 items, even if survey list contains more than 30 responses.

The survey list is a special list, and cannot add new view to it as we do for other lists or libraries, but we can modify the existing views because actually it uses list view web part.

To resolve, please follow below steps:

Step 1: Open SharePoint Site in SharePoint Designer

1. Open SharePoint Designer and click on “Open Site”.
2. Enter SharePoint Site URL (SharePoint Site that contains Survey List). This can be any - SharePoint On Premise OR SharePoint Online Site.
3. Click on “Open”.

Step 2: Navigate To Survey List In SharePoint Designer

1. In navigation section go to Lists and Libraries.
2. Navigate to survey list and click to open.

Step 3: Open View in Advance Mode

In navigation section go to Lists and Libraries, 
1. Go to View Section and Right Click on View named “Overview”
2. In pop-up menu select “Edit File in Advance Mode”.

Step 4: Modify Export Limit

1. Opening view in advance mode will open “overview.aspx” page in new tab.
2. In <XmlDefinition> tag go to <RowLimit> as highlighted in above image.
3. Change this tag to : 
                          Default tag: <RowLimit Paged=”FALSE”>30</RowLimit>
                          Change tag to:  <RowLimit Paged=”FALSE”>1000</RowLimit>
4. Than press “ctrl+s” to save page. This will change item limit 30 to 1000.Now, Export to Excel can be done for 1000 items. This item limit can be increase as per number of items in list. 

Note: Item limit can be increased up to threshold limit of the list. Default limit for threshold is 5000.

So, this way we can export more than 30 items to spreadsheet from Survey List, too.

If you have any questions you can reach out our SharePoint Consulting team here.

June 7, 2016

TFS 2015 - "Completed Date" for Test Run execution is shown with UTC Timezone

We upgraded from TFS 2013 on premise to TFS 2015 on premise. After upgrade, with initial verification we found one issue. After upgrade, if any user executes Test Run for any Test Cases, then the "Completed Date" for Test Run is shown with UTC timezone and not with the specific user's timezone.

As shown in below image, a test run was executed on 5/18/2016 3:04:40 AM in EST timezone. But TFS shows 5/18/2016 7:04:10 AM as Completed Date.

Here, TFS considers time stamp with UTC timezone instead of considering user's timezone.

Initially, we thought this to be some configuration issue. But after analysis and troubleshooting, we identified that, this was a bug in initial release of TFS 2015. This issue has been addressed by Microsoft in TFS 2015 Update 1 and higher.

To conclude, installing TFS 2015 Update 1 and higher on TFS Server will resolve this issue and users will be able to see Test Run execution "Completed Date" with user's local timezone.

If you have any questions you can reach out our SharePoint Consulting team here.

June 2, 2016

SharePoint 2013 - Unable to read Web.Config file in Event receiver

Generally, we use web.config file’s app settings section to keep configurable and application wide settings that an application requires in order to perform the task properly. This helps in easy maintenance and deployment of the application, because we can easily update the settings and verify without build and deployment.

Now we read the key value pairs from web.config file as follow:

I need to use these app settings in Item added Event receiver in SharePoint list. Though, the above code worked fine on local environment, but on production server, it gave exception.
"Object reference not set to an instance of an object"

In the Event receiver, the above code is unable to find and read the web.config app settings, you would've noticed that although code compiles and runs, this comes back null. Well, the very generic answer to why this is, is because the event handler isn't really running within the same context as a Web site that has direct access to the ConfigurationManager.

There is a simple solution for this issue, just change the approach of reading the web.config file.

Below is the method we have implemented to read the web.config file:
public static string GetAppSettingKeyValue(SPSite siteCollection, string key)
            System.Configuration.Configuration config;
            if (string.IsNullOrEmpty(siteCollection.WebApplication.Name))
                throw new ApplicationException("Web application name is empty!");
            config = WebConfigurationManager.OpenWebConfiguration("/", siteCollection.WebApplication.Name);
            AppSettingsSection appSettings = config.AppSettings;
            if (appSettings == null)
                throw new ApplicationException("Web.config appSettings section cannot be found!");
            if (appSettings.Settings[key] == null || string.IsNullOrEmpty(appSettings.Settings[key].Value))
                throw new ApplicationException("Key value cannot be read from settings of appSettings. Make sure this key and its value exist!");
            return appSettings.Settings[key].Value;

And then we just have to call the above method from event receiver’s events with necessary parameters to read the settings as below:
GetAppSettingKeyValue(new SPSite(properties.SiteId), key);

Here, first parameter is SPSite object and the second parameter is a app settings key, for which we need to read value from web.config file.

Thus all we need to do is, just change the approach of reading web.config file and we are done! Now, we can successfully read the app settings configuration.

If you have any questions you can reach out our SharePoint Consulting team here.