Wednesday, September 10, 2014

Vanila Mask Java Script Library to mask the input based on type.

I found a beautiful JS plugin which gives the developer option to mask the in input based on type of input you specify for a text box.

It can be

  1. Date
  2. Phone Number
  3. Car Plate number etc...
Here is the link to the site.

Wednesday, May 29, 2013

How to SHRINKFILE and TRUNCATEFILE in SQL Server 2008.

http://www.codeproject.com/Articles/261132/Truncate-Shrink-Transaction-Log-files-on-SQL-Serve

Updated working Script


 --Step1--  
 CREATE TABLE #TransactionLogFiles (DatabaseName VARCHAR(150), LogFileName VARCHAR(150))  
 INSERT INTO #TransactionLogFiles (DatabaseName, LogFileName)  
   SELECT b.[name], a.[name]FROM sys.master_files a  
   JOIN sys.databases b  
   ON a.database_id = b.database_id  
   WHERE a.[type] = 1 AND b.[name] NOT IN ('master','tempdb','model','msdb')  
     
   --Step 2 --  
     
   DECLARE @DataBase VARCHAR(128)  
 DECLARE @SqlScript VARCHAR(MAX)   
 -- step 2. insert all the database name and corresponding log files' names into the temp table  
 DECLARE DataBaseList CURSOR FOR   
 SELECT DatabaseName, LogFileName FROM #TransactionLogFiles  
 OPEN DataBaseList FETCH  
 NEXT FROM DataBaseList INTO @DataBase  
 WHILE @@FETCH_STATUS <> -1   
 BEGIN  
   
 SET @SqlScript = 'USE [' + @DataBase + '] INSERT INTO #TransactionLogFiles(DatabaseName, LogFileName) SELECT '''  
 + @DataBase + ''', Name FROM sysfiles WHERE FileID=2'  
 --SELECT @SqlScript  
 EXEC(@SqlScript)   
 FETCH NEXT FROM DataBaseList INTO @DataBase END  
   
 DEALLOCATE DataBaseList  
 --Step 3 --  
 SET @SqlScript = ''  
 DECLARE TransactionLogList CURSOR FOR  
 SELECT DatabaseName, LogFileName FROM #TransactionLogFiles  
 DECLARE @LogFile VARCHAR(128)  
    
 OPEN TransactionLogList FETCH  
 NEXT FROM TransactionLogList INTO @DataBase, @LogFile  
 WHILE @@FETCH_STATUS <> -1  
 BEGIN  
 SELECT @SqlScript = @SqlScript + 'USE [' + @DataBase + '] '  
 + 'ALTER DATABASE [' + @DataBase + '] SET RECOVERY SIMPLE WITH NO_WAIT '  
 + 'DBCC SHRINKFILE(N''' + @LogFile + ''', 1) '  
 + 'ALTER DATABASE [' + @DataBase + '] SET RECOVERY FULL WITH NO_WAIT '  
    
 FETCH NEXT FROM TransactionLogList INTO @DataBase, @LogFile END  
 DEALLOCATE TransactionLogList  
 EXEC(@SqlScript)   
   
 -- step 4. clean up  
 DROP TABLE #TransactionLogFiles  

Tuesday, April 2, 2013

Simple Powershell Script to take backup of all site collections in all webapplications in a farm


$webapps = Get-SPWebApplication
foreach($app in $webapps)
{
    $siteCollections = $app.Sites
  
    foreach($sc in $siteCollections)
    {
        $loc="c:\Backups_sitecolls\"+$sc.Url.Substring(7).Replace(':','')+".bak";
        $loc=$loc.Replace('/','_');
        "backing up " + $sc.Url
        Backup-SPSite -Identity $sc.Url -Path $loc -Confirm -Force -NoSiteLock
      
    }
}
This script clears the http:// section of url and replaces and replaces / with _ in the file name of site collection.
This needs a folder "c:\Backups_sitecolls\".
Replace : before port number with empty character.

Thursday, July 26, 2012

Custom Themes, Master Pages, Background Images and Font settings made easy in SharePoint 2013.

            This week i was playing with the SharePoint 2013 space. (Thanks to my Friend and Colleague Atul).

When i was checking for the Changes in Site Settings I observer few additions.

The best thing that i observed is

Composed Looks


Which takes you to the screen.


And you will find the list of all the available Composed looks which will have

Properties

  1.  Name (Name of Compose Look).
  2. Master Page URL
  3. Theme URL
  4. Image URL
  5. Font Scheme URL
  6. Display Order
Where you can provide the link to files that you want to use in your custom Composed Looks.

you can save the local copy of 
  • .spcolor
  • .spfont
files and edit them (They are nothing but plain XML Files). upload them and use them in your custom looks

see the below files .





I feel this is a very neat new feature in new version.

Courtesy: http://www.sharepointdesignlabs.com/blog/Lists/Posts/Post.aspx?ID=16

Wednesday, June 20, 2012

No Author (Created By) Field in SPList.getItems(SPQuery).

Hi,

I assume that you all know that all the list items can be retrieved from SharePoint List using

SPList.getItems(SPQuery)

And returns all the items based on user permission and Filter that were specified in query. The columns that it return by default (For a document library) are

FileLeafRef
Title
ID
ContentType
Created
Modified
_CopySource
_CheckinComment
LinkFileNameNoMenu
LinkFilename
DocIcon
FileSizeDisplay
ItemChildCount
FolderChildCount
Edit
_UIVersionString
ParentVersionString
ParentLeafName
CheckoutUser
Editor

And Author.

The reason why i mentioned Author separately is because GetItems() method return Author Filed only for SiteCollection Admins and application pool admins. 
 
Regual user like site administrator, modifiers, visitors will not get that column.
 
If you are trying to get datatable from GetItems() method and use a custom column that shows Author (created By) column make sure to user elevated privileges based on your need.

Tuesday, April 24, 2012

Custom People Picker

Nice article to build Custom People Picker.


http://sharepointsolutions.com/sharepoint-help/blog/2009/10/create-a-custom-picker-in-sharepoint-2010/

Tuesday, March 20, 2012

Error Compiling SharePoint Workflow in Dev Server.

If any one of have problem compiling the SharePoint 2010 Workflow (Sequential and State Machine) in you Dev Server. And if the Error is this


Even for the empty workflow its giving this error.
Error 1 The "CompileWorkflowTask" task failed unexpectedly.
System.NotSupportedException: The given path's format is not supported.
   at System.Security.Util.StringExpressionSet.CanonicalizePath(String path, Boolean needFullPath)
   at System.Security.Util.StringExpressionSet.CreateListFromExpressions(String[] str, Boolean needFullPath)
   at System.Security.Permissions.FileIOPermission.AddPathList(FileIOPermissionAccess access, AccessControlActions control, String[] pathListOrig, Boolean checkForDuplicates, Boolean needFullPath, Boolean copyPathList)
   at System.Security.Permissions.FileIOPermission..ctor(FileIOPermissionAccess access, String[] pathList, Boolean checkForDuplicates, Boolean needFullPath)
   at System.IO.Path.GetFullPath(String path)
   at System.CodeDom.Compiler.TempFileCollection.EnsureTempNameCreated()
   at System.CodeDom.Compiler.TempFileCollection.AddExtension(String fileExtension, Boolean keepFile)
   at System.Workflow.ComponentModel.Compiler.CompileWorkflowTask.Execute()
   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask, Boolean& taskResult) stateWorkflow1

Check this Thread in MSDN Forum.


http://social.technet.microsoft.com/Forums/en-US/sharepoint2010programming/thread/74975cb4-20f9-4a3f-bb41-74382eecc5bb/#dd666781-46fb-4bb2-b8e8-cf49a4ebfa4b 

Wednesday, September 21, 2011

Look up columns problem with List Templates.

When we try to recreate the lists with look up columns from one site to another site, we lose the look up connection.

For example if have two sites 

A and B

A has list called A1 which has a look up column referring List AL1

If you want to take a copy of list A1 and recreate it in site B as B1 with look up referring to BL1.

Follow these steps

  1. Save List A1 as template (.stp).
  2.  Go to site collection settings.
  3. open the list template gallery.
  4. Save the A1's template in your computer.
  5. Go to the .stp file saved in you computer.
  6. change its extension to .cab 
  7. open the ziped file and extract the files in it to a folder.
  8. Open the manifest.xml file in notepad (or any other text editor).
  9. search for the GUID of list AL1 and replace it with GUID or BL1.
  10. save the manifest.xml file
  11. open command prompt and type the command "makecab manifest.xml template1.stp".
  12. It creates the template1.stp file.
  13. Upload template1.stp to the site collection of B site.
  14. create the list B1 using template1.stp.
  15. If you have multiple look up fields repeat the step 1 to 14 for all those fields.



If this is post is helpful, please leave a comment. Thanks.

Thursday, May 5, 2011

JQuery Script to Move View Selecting Menu to left side.

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>

<script type="text/javascript">

$("td.ms-toolbar:last").insertBefore($("td.ms-toolbar[width='99%']"));

</script>

Friday, April 29, 2011

Copying and Moving SharePoint Designer (2007) Workflows....

Hi,

        This is a common challenge for every one who works on SharePoint Designer Workflows.

       In the working environment, after developing a workflow on a list using SharePoint Designer. There is no Out-of the -Box option to assign that workflow to other List in same server or in other server.

Here is the a simple work around for that

NOTE:- You should have the same column names in both lists. Atleast you should have the columns that you used in rules or actions of the workflow. However, the workflow can be moved eventhough if you dont have the common columns. But the problem is after moving the workflow, the columns that are not present in new list will be listed as blank in workflow. Don't worry you will understand after starting working on it.


Here are the steps.

1) open the WorkFlows folder in SharePoint Designer
2) Expand the workflow that you want to move
3) open <your workflow name> .xoml.wfconfig.xml file.
4) In the Association tag replace the listid with your new list id *.
5) save and close that file.
6) open you workflow xoml file and click finish.
 Thats it you are done.

* In order to find the List ID of your New List open the list setting. In url you can find the list id.
( Replace %7B with {, %7D with }, %2D with -).

Post Comments if you have any trouble doing this.


Please leave a comment if this post is helpful to you.

Thursday, April 21, 2011

No Incoming Email feature in Office 365

Hi,

Two days back i got access to my Office 365 SharePoint site. It is so amazing. I am really excited with this new cloud computing feature. I started using it for my new business.

However it has a drawback. That is, lack of a feature which i expected to have. That is Incoming Email for Lists and Libraries.

Monday, April 18, 2011

Hotfix for Time-Based SPD07 Actions (Pause for, Pause till)

Hi,

If you are using Sharepoint 2007. You will face the problem with Time Based actions in SharePoint Designer Workflow. They are

1) Even if the timer is done the next action will not be processed
2) The cooments field of workflow doesnt update the time remaining to go for next action
3) The workflow will be freezed at pause action forever.

Here is the Hotfix for that problem


http://www.microsoft.com/downloads/en/details.aspx?FamilyID=6096ce0f-d21e-47ac-afe2-d4e1c2fce670&displaylang=en

Thursday, March 24, 2011

A really good article to freeze header in Sharepoint List views.

This is a really good article which explains the jQuery to freeze the header in SharePoint List views.



http://kjellsj.blogspot.com/2009/06/sharepoint-jquery-scrolling-view-with.html


Please leave a comment if this post is helpful to you. Thanks.

Thursday, February 17, 2011

Simple CSS code to hide Time on the top of each entry in Calendar View.

Hi,

In the Calendar View, by default the time will showed on top of each entry.

If you are entering time at the time of new item creation thats fine. But if you are using only Date field then it shows you as 12:00 AM for each entry. In order to hide that in Month and Week view:

1) Site Actions -> Edit Page-> Add WebPart -> Content Editor WebPart.
2) Modify Shared WebPart -> Source Editor.
3) Paste this code


"style

td.ms-cal-monthitem A NOBR {display:none;}

a.ms-cal-dayitem NOBR {display:none;}

/style"
NOTE: style are HTML tags.
.

Done.


Please Leave a comment if this post is helpful to you. Thanks.

Thursday, February 3, 2011

Two Useful links to configure SSL in WSS 3.0 and Windows Server 2003 IIS 6.0

Steps to setup SSL in Windows Server 2003 (IIS 6.0)

http://www.petri.co.il/configure_ssl_on_your_website_with_iis.htm

Steps to setup SSL for WSS 3.0 Web Application

http://volcane.blogspot.com/2008/05/setting-up-ssl-for-windows-sharepoint.html