http://www.forbes.com/2006/06/15/gates-retiring-microsoft-cx_gl_0615autofacescan10.html
Any Comments??
All About SharePoint is a blog about SharePoint, InfoPath and related technologies. It was started in 2005 and has good readership in many countries. It covers SharePoint 2003, 2007, 2010, 2013, 2016 and Office 365. You can read articles, tips, tutorials and news. It has code samples and complete applications as well.
Friday, June 16, 2006
Saturday, June 3, 2006
Checking User Permissions in SharePoint
Following is the code to check the rights of the users. Following code will show only those sites for which user has read privileges.
Function CheckRights(ByVal sitePath As String, Byval strUser as string) As Boolean
//sitePath contains the site that you retrieved in the code shown above
// strUser contains the user for whom you want to check the rights and retrieve sites
Try
Dim blnStatus As Boolean = False
If Not sitePath Is Nothing Or Not sitePath = "" Then
Dim blnStatus As Boolean = False
If Not sitePath Is Nothing Or Not sitePath = "" Then
Dim rtn As String() = parseURL(sitePath)
Dim siteCollection As SPSite
siteCollection = New SPSite(sitePath)
Dim site As SPWeb = siteCollection.OpenWeb(rtn(0))
siteCollection = New SPSite(sitePath)
Dim site As SPWeb = siteCollection.OpenWeb(rtn(0))
Dim allUsers As SPUserCollection = site.Users
Dim user As SPUser
Dim user As SPUser
For Each user In allUsers
If user.LoginName.ToUpper = strUser Then
If user.LoginName.ToUpper = strUser Then
Dim allGroups As SPRoleCollection = user.Roles
Dim group As SPRole
Dim group As SPRole
For Each group In allGroups
Dim right As Integer
right = group.PermissionMask And SPRights.ViewListItems
right = group.PermissionMask And SPRights.ViewListItems
If right = SPRights.ViewListItems Then
blnStatus = True
Return blnStatus
Exit Function
Return blnStatus
Exit Function
End If
Next
Next
End If
Next
Next
Return blnStatus
End If
Catch ex As Exception
//Exception handling code here!
End Try
//Exception handling code here!
End Try
End Function
The function shown above (CheckRights) uses another function called as parseURL(). Following is the code for the parseURL() function:
Public Function parseURL(ByVal _fullPath As String) As String()
_fullPath = System.Web.HttpUtility.UrlDecode(_fullPath)
Dim site As SPSite = New SPSite(_fullPath)
Dim web As SPWeb = site.RootWeb
Dim webPath As String = _fullPath.Replace(web.Url & "/", "")
Dim rtnObject As String() = {"", "", ""}
Dim w As SPWeb
Dim folderPath As String = ""
Dim docLibPath As String = ""
Dim i, j As Integer
While CType(w, Object) Is Nothing
Try
w = site.OpenWeb(webPath)
Dim s As String = w.ID.ToString
'//above will raise the exception too
Catch ex As Exception
w = Nothing
i = webPath.LastIndexOf("/")
If i = -1 Then
Exit While '//means the end of subsite lookup
End If
j = webPath.Length
webPath = webPath.Remove(i, j - i)
End Try
End While
'//if there was some sub-site object then
If Not CType(w, Object) Is Nothing Then
folderPath = _fullPath.Substring(_fullPath.IndexOf(webPath) + webPath.Length + 1)
If folderPath.IndexOf("/") > 0 Then
docLibPath = folderPath.Substring(0, folderPath.IndexOf("/"))
folderPath = folderPath.Remove(0, folderPath.IndexOf("/") + 1)
End If
If docLibPath = webPath Then webPath = "" '_fullPath
rtnObject(0) = webPath
rtnObject(1) = docLibPath
rtnObject(2) = folderPath
Else '//there was no sub-site obect was found
folderPath = _fullPath.Substring(_fullPath.IndexOf(webPath))
If folderPath.IndexOf("/") > 0 Then
docLibPath = folderPath.Substring(0, folderPath.IndexOf("/"))
folderPath = folderPath.Remove(0, folderPath.IndexOf("/") + 1)
End If
If docLibPath = webPath Then webPath = "" '_fullPath
rtnObject(0) = webPath
rtnObject(1) = docLibPath
rtnObject(2) = folderPath
End If
Return rtnObject
End Function
Note: I know this will seem a bit complicated to you if you are a beginner but believe me it is not that complicated. It's pretty straight forward.
1. You retrieve sites from the portal.
2. You plug in CheckRights() function that checks whether the site has a user you passed in as a parameter and whether that user has reader rights.
3. parseURL() function is used by the CheckRights() function.
Just copy and paste the above functions, you may need to do minor tweaking and it should work fine.
-SSA
-SSA
Thursday, May 18, 2006
"A site template has been applied to this site"
This is a very frequent error that users get especially when restoring backed up sites. Here is the exact error message:
Server error: A site template has already been applied to this site. Once a template has been applied, the site must be deleted and recreated in order to apply a different template.
I just found a link on Microsoft site that confirms that this is a problem in the Microsoft products. Here is the link:
I would suggest users to use the second technique, that is, saving your site using "Save as Template" option. Note that you only get this error when you are trying to migrate your site from one location to another, especially if that *another* location is SPS 2003. If you are restoring the site to it's original location, then you don't get this error.
Here is a work around for this problem:
Create a new site on the target location (where you want to restore the site) and when "Select Template" page loads, do not apply a template and leave the page open. Now return to your back up site and restore it. You won't get an error this way because no template was applied to the site.
-SSA
Thursday, May 4, 2006
Creating your own document library with your own set of fields
Creating your own document library with your own set of fields
You manage a large document management system in your organization. Your organization has many departments. You create a site for each department and each site has a document library. You add some custom fields in your library but you don't want the dialog box to pop-up asking users to enter values for the custom fields whenever they insert a new document. You may have experienced this in your company. When you add custom fields in your document or form library, a dialog box pops up every time user tries to add a new document. Suppose, the number of custom fields exceeds 10. You don't want your users to be presented with a dialog box with more than 10 fields to be filled up every time they add a file. You need to add these fields in all the document libraries in your SharePoint Portal. What do you do? Go to each library, and add these fields? Not a good solution!! Wouldn't it be nice if all these fields get added to your document library template? This way when you will add a new document library to a site, all the custom fields will already be part of the document library and interestingly, you won't get that dialog box popping up each time a document is added to the library.

Let's create a document library template of our own with the following new fields:
1. Level
2. Workflow
3. Approver
2. Workflow
3. Approver
Here are the steps to create a template of our own:
1. Go to following location: C:Program FilesCommon FilesMicrosoft Sharedweb server extensions60TEMPLATE1033STSLISTS
2. Copy "DOCLIB" folder and paste it in the same folder. Rename new folder to "MYDOCLIB"
3. Go to: C:Program FilesCommon FilesMicrosoft Sharedweb server extensions60TEMPLATE1033STSXML. This location contains ONET.XML file.
4. After taking back up of the original file, open ONET.XML and locate the following line:
<ListTemplate Name="doclib" DisplayName="Document Library" Type="101" BaseType="1" OnQuickLaunch="TRUE" SecurityBits="11" Description="Create a document library when you have a collection of documents or other files that you want to share. Document libraries support features such as sub-folders, file versioning, and check-in/check-out." Image="/_layouts/images/itdl.gif" DocumentTemplate="101"></ListTemplate>
Copy and paste the following line underneath the above line:
<ListTemplate Name="mydoclib" DisplayName="My Document Library" Type="899" BaseType="1" OnQuickLaunch="TRUE" SecurityBits="11" Description="This is a customized Document Library. Create a document library when you have a collection of documents or other files that you want to share. Document libraries support features such as sub-folders, file versioning, and check-in/check-out." Image="/_layouts/images/itdl.gif" DocumentTemplate="101"></ListTemplate>
5. Open Schema.xml from the following path:
C:Program FilesCommon FilesMicrosoft Sharedweb server extensions60TEMPLATE1033STSLISTSMYDOCLIB
6. Take backup of the original file before making changes. Locate following code in the schema.xml:
<List xmlns:ows="Microsoft SharePoint" Name="Documents" Title="Shared Documents" Direction="0" Url="Shared Documents" BaseType="1" >
<MetaData>
<Fields>
...
<MetaData>
<Fields>
...
Inside <Fields> tag, you can include your own fields. Add following lines inside <Fields> and </Fields> tags:
<Field Type="Text" Name="Level" ShowInNewForm="FALSE" ShowInFileDlg="FALSE" DisplayName="Level"></Field>
<Field Type="Text" Name="WorkFlow" ShowInNewForm="FALSE" ShowInFileDlg="FALSE" DisplayName="WorkFlow"></Field>
<Field Type="Text" Name="Approver" ShowInNewForm="FALSE" ShowInFileDlg="FALSE" DisplayName="Approver"></Field>
<Field Type="Text" Name="WorkFlow" ShowInNewForm="FALSE" ShowInFileDlg="FALSE" DisplayName="WorkFlow"></Field>
<Field Type="Text" Name="Approver" ShowInNewForm="FALSE" ShowInFileDlg="FALSE" DisplayName="Approver"></Field>
Save schema.xml!
7. Restart IIS.
Now, go to "CREATE" page, you will see two document library templates. Select your newly added template and create a document library. This library will have additional fields by default. You can add as many fields as you like.
-SSA
Wednesday, May 3, 2006
Antivirus products for SharePoint
Traditional Anit-Virus programs do not detect viruses in SharePoint document libraries and hence, it is important to use products specific to SharePoint. There are viruses that use vulnerability in SharePoint to allow cross site scripting and spoofing attacks, for example, Bloodhound.Exploit.27 virus.
Here are some products that you can use:
Here are some products that you can use:
McAfee PortalShield for SharePoint
http://www.mcafee.com/uk/products/mcafee/antivirus/coll_env_protection/portalshield.htm
http://www.mcafee.com/uk/products/mcafee/antivirus/coll_env_protection/portalshield.htm
BitDefender for SharePoint
http://www.bitdefender.com/PRODUCT-49-en--BitDefender-for-MS-SharePoint-2003.html
http://www.bitdefender.com/PRODUCT-49-en--BitDefender-for-MS-SharePoint-2003.html
Microsoft Security Article:
http://www.microsoft.com/technet/security/alerts/info/collaborationsecurity.mspx
http://www.microsoft.com/technet/security/alerts/info/collaborationsecurity.mspx
I have tested Sybari and Symantec products, both work fine with SharePoint.
-SSA
SharePoint Explorer
SharePoint Explorer
Download application and source code (730 KB)
I have written a small application that will search your SharePoint Portal for sites and lists. All information will be saved in the database. Application has a small interface with three buttons.

Here are the instructions on how to set up this application on your machine. I could have provided a setup but that would have taken lot of space unnecessarily. It is a small application. One EXE and a couple of DLLs!! I have included the complete source code. If EXE gives you an error and tells you that a DLL is missing, just open the project in your studio, include the missing DLLs and compile it.
1. Unzip the zip file to a location on your hard disk.
2. DB folder contains "db.sql" file. Run this file in SQL Query Analyzer to create database tables and stored procedures. It will create a database named "EDMS".
3. "Config" folder contains "traverse.cfg". This file contains database connection string and your portal's URL.
2. DB folder contains "db.sql" file. Run this file in SQL Query Analyzer to create database tables and stored procedures. It will create a database named "EDMS".
3. "Config" folder contains "traverse.cfg". This file contains database connection string and your portal's URL.
| [database connection string] connection=Server=Your-SQL-Server;Database=edms;uid=sa;pwd=;Pooling=False; connectio1=Server=;Database=Portal1_SITE;uid=sa;pwd= [Root URL] rooturl=http://portal/sites/site1/ |
Modify the following line in the configuration file and provide correct parameters like your SQL Server name, database name, user ID and password if any:
connection=Server=Your-SQL-Server;Database=edms;uid=sa;pwd=;Pooling=False;
Following line contains URL of your portal site. Edit this line. URL should point to your portal. Do not remove the trailing slash ("/").
rooturl=http://portal/sites/site1/
Save the file and copy it to your System32 folder on your system drive. For example, If your system drive is C: then copy "traverse.cfg" to "C:WindowsSystem32".
4. BIN folder inside SPExplorer folder contains the EXE file and the DLLs. This EXE is dependant on the following files to run:
a. Interop.Excel.dll
b. Interop.Scripting.dll
c. SPLib.dll
b. Interop.Scripting.dll
c. SPLib.dll
5. SPExplorer folder contains the source code of the main application. There is another folder called as SPLib. This folder contains the source code for the SPLib.dll assembly.
What does this application do?
This application traverses your portal and finds all sites, subsites, folders, subfolders, lists, etc. It can go to n levels deep for searching. All information is stored in the database. For your convenience, I have created a function that extracts all information from the database and stores it in an Excel file. Click "Start Processing" button to start searching the portal. Click "Generate Excel File" to generate the excel file. Excel file named as SPE-current date-seconds.xls will be generated in the folder where the EXE is being run from. You can run this application periodically to keep the data in the DB updated. After every run, generate a new Excel file. This Excel can be distributed to the managers or other technical people who may be interested to know the number of sites in their organization. Usually, at an enterprise level, each site represents a department in the organization. Therefore, managers may find it useful to have all information about their departments in one place.
This application will serve as a good example for beginners to learn about SharePoint object model.
Send your comments to share.point@yahoo.com
-SSA
Tuesday, May 2, 2006
Error: Local admin can access my WSS sites
A user who has not been permitted access to the content in your Windows SharePoint Services Web sites has full access to this content. The user can visit any Web page in all your Windows SharePoint Services Web sites. Because of the security requirements in your organization, you may not want all the members of the local Administrators group to have this access.
Subscribe to:
Posts (Atom)