A Practical Guide to SharePoint 2013

A Practical Guide to SharePoint 2013
A Practical Guide to SharePoint 2013 - Book by Saifullah Shafiq

Sunday, March 5, 2006

Setting up Windows SharePoint Services as a Collaborative File Store + The solution to your network path error

Following link shows you how to set up Windows SharePoint Services as a file store:


Some friends, to whom I sent this link previously, after visiting the page and after having tried the steps involved complained that they were unable to create a mapped drive for a Windows SharePoint Services site or document library. I had heard about this issue even before so this time i thought i should post the solution to the blog before it gets off my mind again. The error that people usually get is "Network path not found" ... I don't remember the exact error message but the error is related to the network path. You get this error if "WebClient" service is disabled. Enable and Start this service and your problem will be solved. You won't get *network path* error anymore.

Move files by using My Network Places in Windows Server 2003
1. Click the Start menu, click All Programs, point to Accessories, and then click Windows Explorer.
2.  In the Folders list, click My Network Places.
3. In the right pane, double-click Add Network Place.
4. Follow the instructions in the Add Network Place Wizard to add a shortcut to the server running Windows SharePoint Services.
5. After you create the new network place, open a Windows Explorer window, and then find the folder with the files that you want to copy to the document library.
6. Select the files you want, and then drag them into the document library in the network place.

-SSA

Friday, March 3, 2006

LocalSystem Account in Pool Identity

Q: I am experiencing problems in accessing my portal site. I don't know what I have done wrong. I think I changed identity in application's pool. 

Check the identity of your application's pool! Network Service and Local User accounts have low access rights and are useful for situations that do not require access to resources on remote computers. If you are not using single server installation and have your database on a different machine then try setting your pool's identity to LocalSystem Account. LocalSystem Account has higher access rights but poses a security risk.

Submitting to Portal Area does not show the document in portal area?

There are two things that you should take into consideration.
1. If you are submitting to a portal area and you have selected "Home" as the location then you must select your audience. Audience should be all portal users. If you do not select audience then your file will not show on the home page of the portal.
2. If you submit to a specific location in portal area then you must select the exact location. For example, if you submit to "Topics" area, your file will not be visible in this area if it has sub areas. If you want to see your file, then submit the file to the exact location including area + sub area, for example, submit file to Topics > Projects.

Tuesday, February 28, 2006

How to connect a web part to the aspx page?

How to connect a web part to the aspx page?

Scenario: I have created a workflow application for Document and Form Libraries. I have also created an "Administration" application for this workflow application. Admin application consists of a web part. I want to include a button in the navigation bar of the document/form library and clicking that button will take the user to an aspx page which will contain my "admin" web part.
1. Here is the screen shot of the document library:
Note the "Administration" button in the menu bar (encircled in red). This is the new button i just added. This page is linked to the aspx page that contains my web part. Here are the steps:
1. First, decide where you want to include this new link. In your document library? In your form library? Do you want to create a new document library or do you want to modify default document library? Modifying the default document library is not recommended. Keep the default document library intact and create a new document library template instead. As an example, i am adding this button to my form library. Edit the schema.xml file in your form library template. The path is:
C:Program FilesCommon FilesMicrosoft Sharedweb server extensions60TEMPLATE1033STSLISTSXMLFORM
Edit the schema.xml file in editor. Locate following text in the file:

<Default>
<Switch><Expr><GetVar Name="GridSwitch"/></Expr>
<Case Value="Unavailable">
</Case>
<Default>
<HTML><![CDATA[
<TD class="ms-toolbar"> <table cellpadding=1 cellspacing=0 border=0> <tr> <td class="ms-toolbar" nowrap> <a tabindex=2 ID=diidEditInGridButton class="ms-toolbar" title=]]></HTML><HTML>"Edit in Datasheet"</HTML><HTML><![CDATA[ ACCESSKEY=G href="BLOCKED SCRIPTEditInGrid(]]></HTML><GetVar Name="WPQ"/><HTML><![CDATA[varPageUrl,']]></HTML><GetVar Name="View" URLEncode="TRUE"/><HTML><![CDATA[');" target=_self> <img src="/_layouts/images/editgrid.gif" ID="tbbuttonstart1" alt=]]></HTML><HTML>"Edit in Datasheet"</HTML><HTML><![CDATA[ border=0 width=16 height=16></a></td> <td nowrap> <a tabindex=2 ID=diidEditInGridButton class="ms-toolbar" ACCESSKEY=G href="BLOCKED SCRIPTEditInGrid(]]></HTML><GetVar Name="WPQ"/><HTML><![CDATA[varPageUrl,']]></HTML><GetVar Name="View" URLEncode="TRUE"/><HTML><![CDATA[');" target=_self>
]]></HTML><HTML>Edit in Datasheet</HTML><HTML><![CDATA[
</a> </td> </tr> </table> </TD>
At the end of the above code, copy the following additional code. This will add a new button:
<TD class=ms-separator>|</TD>
<TD class="ms-toolbar"> <table cellpadding=1 cellspacing=0 border=0> <tr> <td class="ms-toolbar" nowrap> <a tabindex=2 ID=diidEditInGridButton class="ms-toolbar" title=]]></HTML><HTML>"Edit in Datasheet"</HTML><HTML><![CDATA[ ACCESSKEY=G href="BLOCKED SCRIPTAdministration(]]></HTML><GetVar Name="WPQ"/><HTML><![CDATA[varPageUrl,']]></HTML><GetVar Name="View" URLEncode="TRUE"/><HTML><![CDATA[');" target=_self> <img src="/wpresources/EPWebParts/1.0.0.0__32bb15c33a2f8eca/images/admin.jpg" ID="tbbuttonstart1" alt=]]></HTML><HTML>"Workflow Administration"</HTML><HTML><![CDATA[ border=0 width=16 height=16></a></td> <td nowrap> <a tabindex=2 ID=diidEditInGridButton class="ms-toolbar" ACCESSKEY=G href="BLOCKED SCRIPTAdministration(]]></HTML><GetVar Name="WPQ"/><HTML><![CDATA[varPageUrl,']]></HTML><GetVar Name="View" URLEncode="TRUE"/><HTML><![CDATA[');" target=_self>
]]></HTML><HTML>Administration</HTML><HTML><![CDATA[
</a> </td> </tr> </table> </TD>

Note the bold text in the above code. Administration() is the function that will be called on the click of the new link. Where this function will be added, i will tell you later. You also need to provide proper path to the link's image. "wpresources" is a good location to add store your image along with your web part.
Location of the "wpresources" folder in your inetpub. On my machine the path is:
Because i have installed SharePoint on a different port other than the default port, therefore, i have a different path. Whatever is your default site path, add the "wpresources" folder. This folder will contain another folder that will contain your web part files. "js" folder contains the javascript file that contains the "Administration()" function. Another good location to include this function which many people find easier to find is "ows.js" in the following default path:
C:Program FilesCommon FilesMicrosoft Sharedweb server extensions60TEMPLATELAYOUTS1033
"ows.js" is the default script file that contains all the SharePoint functions. Modifying this file is not a good practice. Either take back up of the original file before modifying it or there are other methods, for example, creating a new script file that will overwrite your default script file. See SDK for more information. Right now, i will be modifying the default js file. Edit the ows.js in your favorite editor and add the following function anywhere in the file:
function Administration(using, viewguid)
{
    document.location = 'AppForm.aspx';
}
Now, you also need to include the AppForm.aspx that you are using in your function. Where will this page be added? The aspx page will be added in your form library's folder. For example, if you are adding new link in your Form library, then add AppForm.aspx in the following folder:
C:Program FilesCommon FilesMicrosoft Sharedweb server extensions60TEMPLATE1033STSLISTSXMLFORM
This ASPX page contains your webpart:
<%@ Register Tagprefix="EPWebParts" Namespace="SharePoint.AdminWebParts" Assembly="AdminWebPart, Version=1.0.0.0, Culture=neutral, PublicKeyToken=65fb13d34a5f5gsa"%> 
 

Friday, February 24, 2006

Creating Reports with Access

Long time ago, some one asked me whether we could export data from SharePoint to Access and my answer was "Yes, we can. Export data to spreadsheet using the Export to spreadsheet link and then manually import data from the Excel sheet into the Access database.". That was long time ago, I didn't know at that time that it was possible to export data to Access directly from with in SharePoint. Not only that, you can create reports easily from with in SharePoint. For example, you have a document library with a long list of documents, you want to create and present a report containing this list of documents to your manager. You can create a beautifully formatted report using Access. Here is how you do it:

1. In document library, click "Edit in Datasheet".
2. Click Task Pane to open it. It will show you office links.
3. Click "Report with Access". You can export data to an existing database or if you don't have an already created database, you can create a new one. When you  click "Report with Access".  SharePoint asks you whether you want to export to an existing database or create a new database. Select your option and click OK. SharePoint does the remaining work. It will create a table in Access, add data to that table and then create a clean simple report for you. Now if you want to format the report, click the Design button and add the header and footer of your choice. Add colors, borders or what ever you like in the report template. Save it and you are done.
This tip shows you how you can create a report containing data from a document library. You can use same functionality to create reports for other lists. I think this is a very easy way of creating cool reports.

-SSA

Tuesday, February 14, 2006

Working With Excel

Many people know that it is easy to save lists in SharePoint as Excel sheets. For example, if you are in a document library, select "Export to spreadsheet" from the Actions menu to export data to Excel. There are other things that you can do with Excel, for example, you can create charts with Excel, you can print content, etc. Another interesting feature is that you can edit your SharePoint lists in Excel.
1. If you have a document library, select "All Documents" view and click "Edit in Datasheet".
2. Click "Task Pane" to open the task pane. You will notice there are several features that you can take advantage of. Because we are discussing Excel at the moment, so let's stick with it.
3. In the Task Pane, select "Export and Link to Excel". "Opening Query" dialog box will pop up. Click "Open" to open the Excel sheet.
4. Another pop up dialog box "Import Data" will open up. By default, "New workbook" is selected. Click OK to open a new workbook.
5. Now, you can edit any of the row in the list. There are some columns like Modified By, Created By, etc that you can not edit but other fields especially custom fields can be edited and once you are done with editing, select Data > List > Synchronize List to synchronize the list. Your data will synchronize with SharePoint. Easy? Isn't it?

-SSA

Saturday, February 4, 2006

How can we retrieve an older version of a document using .NET?

How can we retrieve an older version of a document using .NET?

spFile = EventWeb.GetFile( _FileName );
if (spFile.Versions.Count > 1)
{
 //restore previous version
 spFile.Versions.Restore(spFile.Versions.Count - 1);
}
Similarly, you can delete the document version:
spFile.Versions.Delete(spFile.Versions.Count - 1);