Thursday, 4 February 2016

How to add separator to string at every N characters?

I was having a strange requirements last days and one of them is this one:

we have a string and we want to add a separator after 8 digit.

Here is the post which help me to achieve the my solution:
http://stackoverflow.com/questions/9932096/add-separator-to-string-at-every-n-characters

Solution:

here is the solution that worked for me:

string x = "111111110000000011111111000000001111111100000000";
output should be :
"11111111,00000000,11111111,00000000,11111111,00000000,"

C# : Regex.Replace(myString, ".{8}", "$0,");

Javascript:

"111111110000000011111111000000001111111100000000".replace(/(.{8})/g,"$1,")


Error Occurred in Deployment step 'Recycle IIS Application Pool'

Currently we have moved our development environment and one common error I faced after moving them was :
Error occurred in deployment step 'Recycle IIS Application Pool':
<nativehr>0x80070005</nativehr><nativestack></nativestack>Access denied

Solution:

Original Post: http://stackoverflow.com/questions/21278281/error-occurred-in-deployment-step-recycle-iis-application-pool

Here are the steps that worked for me:

  1. Go to Central Administration site
  2. Navigate to the Manage Web Applications page
  3. Click on the web application that hosts the site you are trying to deploy to
  4. Click the User Policy ribbon item.
  5. Add your windows account to the list of users with the Full Control permission.

Friday, 8 January 2016

Error: Value does not fall within expected range SharePoint

While accessing SharePoint Document Library files I face a strange error as the code I was using was used before and was working fine earlier. Here was the error message:

Error: Value does not fall within expected range

Code Sample:

SPFileCollection files = currentlist.RootFolder.SubFolders[curfileitem.Url.Substring(0, curfileitem.Url.LastIndexOf('/'))].Files;

I found that if I have hierarchy of folder then the above code will throw an error.                        

Solution:

Through google I found out a new method to get files collection. Here is the code sample:

SPFolder folder = properties.Web.GetFolder(curfileitem.Url.Substring(0, curfileitem.Url.LastIndexOf('/')));

SPFileCollection files = folder.Files;

Make sure you provide full path of your folder. i.e. your web path / doc library title / folder path.

Thursday, 17 December 2015

How to find the SQL Instance edition ?

Q: How to find the SQL Instance edition ?

Ans: First I thought, its Microsoft. Go to help menu and click on About. It will give you the edition you have installed. But the answer is no. This time it displayed numbers and something which was little bit hard to understand.

So what we do? google it.

And first you find links of Microsoft which is confusing to people like me. So here is the solution.

Follow below steps :

  1. Open you SQL server and connect your database.
  2. Open (Ctrl + n) new querywindow for master database.
  3. And write below query to get understandable answer:
SELECT SERVERPROPERTY('productversion'), SERVERPROPERTY('productlevel'), SERVERPROPERTY('edition')

Note: Above query works for SQL Server 2000 and above 

In other scenario you can use

SELECT @@VERSION
Output will be like :
       Microsoft SQL Server 2012 (SP1) - 11.0.3401.0 (X64) 

Jan  9 2014 13:22:15 

Copyright (c) Microsoft Corporation

Standard Edition (64-bit) on Windows NT 6.2 <X64> (Build 9200: ) (Hypervisor)

Original Source: 

http://stackoverflow.com/questions/59444/how-do-you-check-what-version-of-sql-server-for-a-database-using-tsql

Friday, 27 November 2015

Error - URL Name can not contain any of the following characters


Assume that you type a page name, such as “Text with space” in the New item form in a pages library in SharePoint Server 2013 to create a new page. After you create the page, the automatically generated URL is inconsistent with the preview URL. For example, the preview URL may be displayed in a label as follows:



Solution:

1. Go to "Site Settings". 
2. Click on "Page Layout and Site Template Settings" under "Look and Feel".
3. Scroll down and check option "Convert blank spaces in page name to'-'".

Case 2

If you have installed SharePoint April to September Cumulative Update package 2015 then you might face above error even you have checked the option given in solution above. 

Solution: 

This issue is resolved in October 2015 Cumulative Update. Reference Links are:
https://support.microsoft.com/en-us/kb/3085567
http://thesharepointfarm.com/2015/04/ms15-036-and-april-2015-cu-createpage-issue/

Wednesday, 25 November 2015

Enable SmallSearchbox in Search result page SharePoint

Recently I was given a task to enable Search Bar in Search result page of SharePoint. If you meet such requirement here is the simple solution:

Case 1: You have not configured search service:

In this case your search will open SharePoint default result page: osssearchresults.aspx.

You can find this page in "C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\TEMPLATE\LAYOUTS".

Open this page and in "PlaceHolderSearchArea" ContentPlaceHolder add below lines of code:

 <div id="searchInputBox">
<SharePoint:DelegateControl runat="server" ControlId="SmallSearchInputBox" />                                 
</div>

save the file.

Refresh your search page and you will see the search bar in header section.

Case 2: You have configured Search service:

In this case your search will open pages/result.aspx page for search result.
But we can't add our code in this page. We need to add our block of code in the page layout of this page.

You can find that in "Site settings->masterpages & page layouts -> SearchResult.aspx"
Download this page.

Open this page and in "PlaceHolderSearchArea" ContentPlaceHolder add below lines of code:

 <div id="searchInputBox">
<SharePoint:DelegateControl runat="server" ControlId="SmallSearchInputBox" />                                 
</div>

save the file.

If you refresh your  page and you get error "Sorry, Something went wrong", Please check this blog.


SearchResult.aspx: Code blocks are not allowed in this file.

Recently I was working with search bar in search result page where I encounter below error:

Sorry, Something went wrong
An error occurred during the processing of /sites/search/_catalogs/masterpage/searchresults.aspx. Code blocks are not allowed in this site.


Solution:

1. Open Web.config
2. find <PageParserPath>
3. Add below line in it.

<PageParserPath VirtualPath="/*" CompilationMode="Always" AllowServerSideScript="true" IncludeSubFolders="true" />

Tuesday, 24 November 2015

SharePoint 2013: August 2015 Cumulative Update Package Installation Failed

Recently I was installing SharePoint 2013 Cumulative Update August 2015 when I encounter below error couple time.

"The installation of this package failed"

Solution:

The best workaround for this issue is to simply run the installation package 3 times. The package will fail to install with the above error on the first two attempts, but should be successful on the third attempt.  The installation will not be corrupt and there are no other known issues once you have the update package successfully installed.

Original Source: http://blogs.msdn.com/b/tehnoonr/archive/2015/08/28/sharepoint-2013-august-2015-cumulative-update-package-fails-to-install.aspx

Error : Mount-SPContentDatabase : This content database has a schema version which is not supported in this farm

While restoring a database from one farm to other I encounter below error:

Mount-SPContentDatabase : This content database has a schema version which is not supported in this farm

Reason:

When I check the version of current SharePoint and restore database version they were different.

You can check current SharePoint version as follow:

Go to Central Administration -> System Settings-> Servers-> Manage Servers in the farm.

You can check the version of the database in version table of content database.

You can check SharePoint build version here.

Solution:

You need to install updates in your new farm and when your SharePoint and database version are same you can Mount database to new farm.

SharePoint 2013 Build versions

SharePoint 2013

Build Number
Build Name
Component
Information Link
Download Link
Notes
15.0.4128.1014 Beta SharePoint Foundation 2013   Download Bugs, Notes, & Regressions
15.0.4128.1014 Beta SharePoint Server 2013   Download
15.0.4128.1014 Beta Project Server 2013   Download  
​15.0.4420.1017 ​RTM ​​SharePoint Foundation 2013 Download ​Bugs, Notes, & Regressions
​​15.0.4420.1017 ​RTM ​SharePoint Server 2013 Download
​​15.0.4420.1017 ​RTM ​Project Server 2013 Download
​15.0.4433.1506 ​December 2012 Hotfix ​SharePoint Server 2013 KB2752058 Download ​Bugs, Notes, & Regressions
​15.0.4433.1506 ​December 2012 Hotfix ​SharePoint Server 2013 (coreserver) KB2752001 Download
​15.0.4481.1005 ​March 2013 Public Update ​SharePoint Foundation 2013 KB2768000 Download Bugs, Notes, & Regressions
​​15.0.4481.1005 ​​March 2013 Public Update ​SharePoint Server 2013 KB2767999 Download
​​15.0.4481.1005 ​​March 2013 Public Update ​Project Server 2013 KB2768001 Download
​15.0.4505.1002 ​April 2013 CU ​​SharePoint Foundation 2013 KB2751999 Download Bugs, Notes, & Regressions
​15.0.4505.1005 ​​April 2013 CU ​SharePoint Server 2013 KB2726992 Download
​15.0.4505.1005 ​April 2013 CU ​Project Server 2013 KB775426 Download
​15.0.4517.1003 ​June 2013 CU ​SharePoint Foundation 2013 KB2817346 Download Bugs, Notes, & Regressions
​15.0.4517.1005 ​June 2013 CU ​​SharePoint Server 2013 KB2817414 Download
​June 2013 CU ​Project Server 2013 KB2817415 Download
​15.0.4535.1000 ​August 2013 CU ​​SharePoint Foundation 2013 KB2817517 Download Bugs, Notes, & Regressions
​​August 2013 CU ​SharePoint Server 2013 KB2817616 Download
​​August 2013 CU ​Project Server 2013 KB2817615 Download
​15.0.4551.1001 ​October 2013 CU ​SharePoint Foundation 2013 KB2825674 Download Bugs, Notes, and Regressions
​15.0.4551.1005 ​October 2013 CU ​SharePoint Server 2013 KB2825647 Download
​October 2013 CU ​Project Server 2013
​15.0.4551.1508 ​December 2013 CU ​SharePoint Foundation 2013 KB2849961 Download ​Bugs, Notes, and Regressions
​15.0.4551.1511 ​SharePoint Server 2013 KB2850024 Download
​15.0.4551.1508 ​Project Server 2013 KB2837668 Download
​15.0.4569.1000* ​Service Pack 1 ​SharePoint Foundation 2013 KB2817439 Download Bugs, Notes, and Regressions
​SharePoint Server 2013 KB2817429 Download
​Project Server 2013 KB2817434 Download
​15.0.4571.1502* ​Service Pack 1 Mark 2 ​SharePoint Foundation 2013 KB2880551 Download Bugs, Notes, and Regressions

​​ ​SharePoint Server 2013 KB2880552 Download

​​ ​Project Server 2013 KB2880553 Download
​​15.0.4605.1000 ​April 2014 CU ​​SharePoint Foundation 2013 KB2863892 Download ​​Bugs, Notes, and Regressions
​​SharePoint Server 2013 KB2878240 Download
​Project Server 2013 KB2880484 Download
​15.0.4615.1001 ​MS14-022 ​SharePoint Foundation 2013 KB2952166 ​Links in KB Bugs, Notes, and Regressions
​SharePoint Server 2013 KB2952166 ​Links in KB
​Project Server 2013 KB2952166 ​Links in KB
15.0.4617.1000 ​June 2014 CU SharePoint Foundation 2013 KB2881063 Download Bugs, Notes, and Regressions
​SharePoint Server 2013 KB2881061 Download
​Project Server 2013 KB2881062 Download
​ 15.0.4631.1001 ​July 2014 CU ​SharePoint Foundation 2013 KB2882999 Download ​​Bugs, Notes, & Regressions
​​SharePoint Server 2013 KB2882989 Download
​Project Server 2013 KB2882990 Download
​15.0.4641.1001 ​August 2014 CU ​SharePoint Foundation 2013 KB2883081 Download Bugs, Notes, & Regressions
​SharePoint Server 2013 (1/5) KB2760213 Download
​​SharePoint Server 2013 (2/5) KB2880559 Download
​​SharePoint Server 2013 (3/5) KB2883078 Download
​​SharePoint Server 2013 (4/5) KB2883085 Download
​​SharePoint Server 2013 (5/5) KB2883086 Download
​Project Server 2013 KB2883083 Download
​15.0.4649.1001 ​September 2014 CU ​SharePoint Foundation 2013 KB2883087 Download Bugs, Notes, & Regressions
​SharePoint Server 2013 KB2883068 Download
​Project Server 2013 KB2883072 Download
​15.0.4659.1001 ​October 2014 CU ​SharePoint Foundation 2013 KB2889946 Download ​​Bugs, Notes, & Regressions
​SharePoint Server 2013 (1/3) KB2899469 Download
​SharePoint Server 2013 (2/3) KB2880962 Download
​SharePoint Server 2013 (3/3) KB2880485 Download
​Documentum Connector KB2752098 Download
​Project Server 2013 KB2889959 Download
​15.0.4667.1000 ​November 2014 CU ​SharePoint Foundation 2013 KB2899468 Download Bugs, Notes, and Regressions
​​SharePoint Server 2013 KB2889944 Download
​Project Server 2013 KB2889949 Download
​15.0.4675.1000 ​December 2014 CU ​SharePoint Foundation 2013 KB2910945 Download Bugs, Notes, and Regressions
​SharePoint Server 2013 KB2910938 Download
​Project Server 2013 KB2910911 Download
​15.0.4693.1001 ​February 2015 CU ​​SharePoint Foundation 2013 KB2920801 Download Bugs, Notes, and Regressions
​​SharePoint Server 2013 KB2920804 Download
​​Project Server 2013 KB2920796 Download
​15.0.4701.1001 ​March 2015 CU ​SharePoint Foundation 2013 KB2956159 Download Bugs, Notes, and Regressions
​SharePoint Server 2013 KB2956166 Download
​Project Server 2013 KB2956162 Download
​15.0.4711.1000 ​April 2015 CU ​SharePoint Foundation 2013 KB2965261 Download Bugs, Notes, and Regressions
​​SharePoint Server 2013 KB2965266 Download
​Project Server 2013 KB2965263 Download
​15.0.4719.1002 ​May 2015 CU ​SharePoint Foundation 2013 ​​Bugs, Notes, and Regressions
​SharePoint Server 2013 KB3039780
​Project Server 2013 KB3039753
​15.0.4727.1001 ​June 2015 CU ​SharePoint Foundation 2013 KB3054864 Download Bugs, Notes, and Regressions
​SharePoint Server 2013 KB3054866 Download
​Project Server 2013 KB3054865 Download
​​15.0.4737.1001 ​July 2015 CU ​SharePoint Foundation 2013 ​Bugs, Notes, and Regressions
​SharePoint Server 2013
​Project Server 2013
​​​15.0.4745.1001 ​August 2015 CU ​​SharePoint Foundation 2013 KB3055004 ​​Bugs, Notes, and Regressions
​SharePoint Server 2013
​​Project Server 2013 Download
​15.0.4753.1000 ​September 2015 CU
SharePoint Foundation 2013
KB2975894 Bugs, Notes, and Regressions
​SharePoint Server 2013
​Project Server 2013
​15.0.4763.1000 ​October 2015 CU ​SharePoint Foundation 2013 KB3085488 Download ​​Bugs, Notes, and Regressions
​SharePoint Server 2013 KB3085492 Download
​Project Server 2013 KB3085489 Download
​15.0.4771.1000 ​November 2015 CU ​SharePoint Foundation 2013 KB3101368 Download ​Bugs, Notes, and Regressions
​SharePoint Server 2013 KB3101373 Download
​Project Server 2013 KB3101369 Download

Original Source: http://www.toddklindt.com/blog/Lists/Posts/Post.aspx?ID=346

The "Mark as Decorative" Feature in SharePoint: A Small Toggle With a Big Accessibility Impact

If you've spent any time building pages in SharePoint Online, you've probably noticed a new checkbox tucked inside the Accessibility...