Tuesday, August 23, 2011

Upload files from local machine to SharePoint document library Automatically (DOS command)

From research I have found so many ways to upload files / documents from File server or from local desktop to SharePoint document library. There are lots of JavaScript available to achieve this goal.
But using these methods end user definitely becomes crazy.
Here I have used a very simple method which automatically uploads document from source folder to SharePoint document library.
Following steps we have to implement to use this method.
·        On your machine map a SharePoint site, make sure to create a mapped drive of SharePoint site (not a network place)
·        This will assign a letter to site (i.e. Z), and this will create a SharePoint site as a folder.
·        So now we have “Z” drive which contains our SharePoint site and all its content and when you navigate to any of the content make sure it will open a folder with “z:\content folder” (as simple as opening a local folder in C / D drive)
·        Now we have two local drives one is Source folder and one is SharePoint site.
·        Now run following command to check whether we are able to copy documents from one location to another (From local source folder to SharePoint site)

COPY “sourcefolder\filename” “destination (SharePoint Site)”

Copy c:\Pratik\*.* z:\Documents

·        (Above command will copy all files from “C:\Pratik” folder to SharePoint site)
·        If this will be done successfully then simply create a batch file which copies documents on a click
·        And to make this click automated put that batch file in windows task scheduler so that @ a specific time frame it will run and picks up document from local source folder and uploads it to SharePoint site.
·        You might face some issues while making map drive, to resolve it follow these steps
On Windows XP machine
·        Right click “My Computer” > Map Network Drive
·        It will open a wizard, provide SharePoint site name with UNC path (i.e file://servername/folder)
·        If you will get any error please chec webclient is activated on the machine.
On Windows 7 machine
·        Right click “My Computer” > Map Network Drive
·        It will open a wizard, provide SharePoint site name same as you provide in explorer address bar (http://sitename/)
Suggations and feedbacks are always welcome J. Feel free to reach me n case of any issues.

Thursday, August 4, 2011

Excel file is opening with “Unable to Load Workbook” in browser

Error: Unable to Load Workbook
The workbook that you selected cannot be loaded because it contains the following features that are not supported by Excel Services:

Comments, ActiveX controls, Shapes, Text Boxes, Pictures, WordArt, Clip Art, Embedded OLE objects, Ink Annotations, Forms Toolbar controls, Control Toolbox controls, Charts that are part of a group, Signature Lines, or Camera objects

Contact the workbook author.

Learn more about what features are not supported by Excel Services…


I removed Text Boxes, Clip Arts, Shapes but no luck still got the same error.
Also removed formulas but error remained same. Followed all possible ways to get rid of this error and checked for all possible root causes mentioned in above error but did not get success.
Finally found one column using a formula “SUMPRODUCT” and it was referring another excel sheet.
Copied data of that column pasted it as a value and removed formula.
Saved the file
Uploaded again it to document library
And then we were able to view that excel file in browser.

Thursday, July 28, 2011

The column name you have entered is already in use or reserved. Choose another name


I have faced very interesting issue last night.One of the users had changed / renamed the default content type “Title” to “Item Title” and when he tried to pull it back it gave an error – “The column name you have entered is already in use or reserved. Choose another name”
After modifying default name to custom name he realized that “Title” name had been changed to all over sites because on site all lists / libraries were inherited from parent content type. As a farm admin I even tried with no luck and got the same error.
There is a small JavaScript we have to run in browser which clears all the values in the forbidden column collection array and gives you a confirmation
And after running following JavaScript I got rid of that issue.
javascript:g_FieldName={};alert('Successfully cleared forbidden columns');

Rename wiki page title in MOSS 2007 / SharePoint 2010 without changing site URL

In Wiki pages if you change the page title it will also change the site URL.
So if you have put it as a reference on any site that link will be broken
Here is the method I have successfully used to change the page title without changing the site URL
  • Open the SharePoint site in SharePoint Designer

  • In Design mode select the page title, and rename it

  • Here I have found very weird behavior that in code window <title> parameter is missing so to generate <title> parameter remove Page Title from the design view

  • Page title is associated with “SharePoint:ListItemProperty”, so when we remove page title from the page this parameter will be removed in the code <SharePoint:ListItemProperty runat=”server”/>

  • Now in the design window add your own title which will generate <p> your title </p> parameter in code and you can refer this parameter for any future changes.

You can hide the page (Wiki page) title by simply adding comment “<!-- <p> title </p> -->”
Feel free to reach me in case of any queries.

Thursday, June 30, 2011

Add image to custom list with calculated / conditional column.

This is the method, I followed to achieve – add image to custom list with calculated / conditional column.


Following is the result list (check Status Icon column)

  • Diff is a calculated column based on Col1 and Col2
  • It compares values of Col1 and Col2 , if Col2 > Col1
    Diff gives us “1″ and if Col1 < Col2 then it gives us “0″
=IF(Col1<=Col2,”1″,”0″)   is the formula I have used

  • My AIM is to get “Green” signal when Diff = 1 and “Red” when Diff = 0
  • Here I have used KPI icon but we can use any image.
  • Download following images on your desktop 

  • Navigate to your site > Picture Libraries
  • Select Shared Pictures > Upload > Browse
  • Select icon image file and upload it to the Share Pictures library
  • Click the icon image displayed in the Share Pictures library.
  • Click the Preview image displayed on the next screen to view the image itself.
  • Copy the Image URL
  • Navigate to the List you want to have the icons displayed in.
  • List Settings > Create column
  • Provide Following details for the column
  • Column name – Status Icon
  • Column Type – Calculated (calculation based on other columns)
  • The data type – Single line of text
  • Add it to default view
  • This is the conditional “IF” formula I have used 

After adding above formula list will look like

  • And finally to convert HTML DIV tag to image we have to add following JavaScript which will call the image from the Shared Picture and display it column.
  • Add following JavaScript to Content Editor Web Part after List.
Found following script from
http://blog.pathtosharepoint.com/2008/09/01/using-calculated-columns-to-write-html
to write HTML in to calculated column and convert HTML tag to IMAGE
 
Make sure to add this script in CEWP after list.
Feel free to reach me in case of any doubts.