A Practical Guide to SharePoint 2013

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

Friday, October 29, 2010

SharePoint 2010 Event in Lahore - Photos

SharePoint 2010 Event in Lahore Photos:


Presenting in Lahore

SharePoint 2010 presentation

I presented at an event in Lahore today. The audience was just too great.

Friday, October 22, 2010

Reminder: I am presenting "SharePoint 2010 for Communities" today at ROCS

Just a friendly reminder that I am presenting "SharePoint 2010 for communities" today at 1st Riyadh Online Community Summit. The session starts in 1.5 hours. If you have not registered yet, please do so now. The URL is:


We will give away a free MSDN subscription at the end of the event. The first two people who will ask questions at the end of my presentation will get a free membership for a SharePoint 2010 site.

Monday, October 18, 2010

1st Riyadh Online Community Summit - Oct 21 and 22

Register today to hear excellent speakers that would speak on some very interesting topics. 1st Riyadh Online Community Summit consists of rich knowledge filled content.


Welcome to First Riyadh Online Community Summit.

Riyadh SharePoint User Group, DevLifeStyle, Windows Phone Middle East, SQLPath, Community Leads from Riyadh and MVPs from all around the world are pleased to announce the the first Riyadh Online Community Summit being held on October 21-22, 2010.

The event will cover a wide array of topics ranging from Client to Mobile Programming, Database Development and Administration, all the way to SharePoint Collaboration and Systems Integration.

Please note that this is an ONLINE TWO Day Event.

Webinar Registeration Link:


The timings below are KSA Time (GMT +3)

We will be giving away 1 MSDN Subscriptions with Visual Studio 2010 at the end of everyday (Worth 12K USD).

Agenda Day 1 (21 October 2010 : 1 PM to 6 PM)
Session Time Speaker
Connecting Systems with WCF: The Basics 1:00 PM Halabi
Developing Applications with Silverlight 4.0 2:00 PM Mossalem
SQL Server Tips and Tricks, Real cases with developers 3:00 PM Nabeel
What vs How:Functional Programming Introduction 4:00 PM Ahmed
Building Composite Applications using SharePoint Designer 2010 5:00 PM Muhanad
Agenda Day 2 (22 October 2010 : 1 PM to 6 PM)
Session Time Speaker
SharePoint 2010 Communities 1:00 PM Saif
SharePoint 2010 Document Management Hands On 2:00 PM Jerry
Windows Phone 7: 0 to 60 in no Time 3:00 PM Adel
Animating Business In Blend 4:00 PM Joel
Software Design Principles 5:00 PM Hammad
* Details Below.s


Adel El Zubeir
Sr. Developer and Community Lead Windows Phone Middle East
Adil is Sr. Developer and currently working as Consultant. Adel gained strong knowledge in Windows Mobile since he got his first Windows device. Adel is currently the founder of the new "Windows Phone Middle East" Community, Windows Mobile Power Group on Facebook; to spread out his knowledge on mobility.

Ahmed El Shrief
Community Contributer Saudi
IT Project Manager and Technical Consultant. Developing for Windows, Mac and Linux for more than 15 years. He is community voluntter and regulary speaks at Various Microsoft Technical Communities in Saudi Arabia.

Saifullah Shafiq
SharePoint MVP
Saifullah Shafiq is a blogger, author and technology consultant. He provides SharePoint consultancy to the clients on the East coast of the US. Saifullah maintains a SharePoint blog that is read all over the world, whereever there are people who work in the SharePoint technology. Saifullah has also authored books and has been writing technical articles since 1999. Saifullah was first awarded SharePoint MVP status in 2007 and has maintained the status since then.

Hammad Raoub
Microsoft MVP
Connected System Developer MVP for last 6 years as well as a privileged member of Microsoft's Business Platform Technology Advisors (previously Connected System Advisory board). My areas of interest include Enterprise Architecture, Highly Scalable Computing, SOA, .NET, Design Patterns and Quantum Computation. I have presented at various international conferences on Architecture, Design and Software Development. I am a published author, a geek, father of beautiful twin girls and a husband. I have been involved with various technical communities in Middle East, Singapore and Pakistan. I have also conducted courses at Dept. Of Computer Science, University of Karachi and PAF KIET as a visiting faculty member.

Jerry Yasir
SharePoint MVP - RSUG Founder, SharePoint Consultant at EJADA
Jerry is SharePoint Server MVP, Trainer, Founder of Riyadh SharePoint User Group (RSUG.NET), Co-Owner of SharePoint Pakistan User Group and Sr. SharePoint Consultant at EJADA, Saudi Arabia. RSUG is one of the biggest SharePoint Community in Saudi Arabia with over 1500 Members. He holds a Master degree in Computer Sciences and has over 8 Years of experience working in Microsoft Technologies including SharePoint, Microsoft .NET and Project Server. He is a regular speaker at Microsoft events and community related events around the world. He is currently responsible of developing and managing many large scale SharePoint implementations in Saudi Arabia.
He is Microsoft Certified Trainer (MCT) and also holds MCPD, MCTIP and MCTS for SharePoint 2010 Admin and Development, and MCTS WSS 3.0 & SharePoint Server 2007, MCPD, MCITP (EPM 2007) and MCSD.NET
He can be found at @ http://jerryyasir.wordpress.com/

Joel Cochran
Expression Blend MVP
Joel Cochran is an Expression Blend MVP, an INETA Community Champion, and a Microsoft Certified Technology Specialist (MCTS) in Windows Forms and WPF. He has been developing in C# since 2003 and is a Blend fanatic and self-proclaimed "Blend Evangelist". A frequent speaker at User Groups and Code Camps, he enjoys teaching and writing about .NET and other topics.
You can find him online at http://www.developingfor.net or on Twitter at http://twitter.com/joelcochran.
Joel has served as the Director of Operations for Stonewall Technologies, Inc., an ISV, in Staunton, VA, since 2000.

Muhammad Halabi
DevLifeStyle Lead & Solution Architect
"Mohamad is a Microsoft MVP. He Works as a connected systems architect and has vast experience in Microsoft technologies such as .NET Framework, BizTalk Server, WCF, and WF and has great interest in Cloud Computing and Windows Azure. He is frequent speaker in Microsoft events such as GDC 09 and Tech-Ed Dubai. He is also Devlifestyle community lead. You can reach him at http://thedotnethub.blogspot.com/"

Muhammad Mossalam
Mohamed Mosallem is a Development Lead based in Riyadh, he has been working with the .net Framework since it’s early beta in 2000, he is specialized in developing Enterprise .net Applications and Enterprise Applications Integration, Mohamed is a community board member and regular speaker at DevLifeStyle the first .net users group in Riyadh, he can be reached through his blog www.mosallem.com

Muhanad Omar
SharePoint MVP
Muhanad Omar is a consultant, trainer, international speaker and community advocate who helps organizations in the Middle East successfully develop, deploy and derive value from solutions built on SharePoint. Muhanad is the Managing Director and Principal Consultant for Devosis and specializes in architecture, deployment, administration and business adaption of SharePoint. Muhanad is a three-time recipient of the prestigious Microsoft Most Valuable Professional (MVP) award for SharePoint Server, and the Founder and Leader of the Jordan SharePoint User Group.

Nabeel Derhem
DevLifeStyle & SQLPath Board Member
Nabeel Derhem is a Solution Architect & Consultant specializing in SQL Server with more than 11 years of experience. He is an MCT, MCITP, MCDBA, and MCSD with a Bachelors degree in Computer Science and a Masters in Business Administration.
Consulted by numerous enterprises in the region, he is a frequent speaker in many local communities and Microsoft events. He is the founder of SQLPath community group.

Event Agenda Day 1
Opening Notes - MVPs & Community Leads 10 Minutes
Welcome note and Agenda and Review of the event.

Connecting Systems with WCF: The Basics (Level 200) - Halabi 1 Hour
This session will discuss the role of Windows Communication Foundation (WCF) in connecting systems. After an overview of WCF advantages and messaging basics, the session will show how WCF as a message communication mechanism combines with other connected systems technologies such as BizTalk, WF, MSMQ, and the .NET Service Bus to facilitate systems integrations.
Prerequisites: Basic knowledge of WCF, BizTalk, WF and .NET Services is a plus but not required as the session will tackle the basics.

Developing Applications with Silverlight 4.0 (Level 100) - Mosselam 1 Hour
New to Silverlight and looking for ways to build seamless, rich web experiences and line-of-business applications? This session is where you can start. We will cover how to get started building your first application. We’ll also highlight the capabilities and functionalities of Silverlight 4.0.

SQL Server Tips & Tricks, Real cases with developers - Nabeel (200) 1 Hour
Application developers do get the job done, but they usually don't know (or care) how SQL Server works, and this causes performance issues in the long run. This session is about introducing some of these concepts using real cases where developers misuse queries and features from SQL Server, and discussing alternative effective ways to handle them.

What vs How: Functional Progmg. Introduction(Level 100) - Ahmed 1 Hour
This can include the concepts behind functional programming with C# (LINQ, lambda expressions and anonymous methods), XAML and maybe a quick review of F#..

Building Composite Apps using SP Designer(Level 200) - Muhanad 1 Hour
In this demo-packed session, we’ll take a look at the various capabilities SharePoint Designer 2010 provides for building out composite applications for SharePoint 2010. Demos include working with the Data View Web Part, applying conditional formatting, and integrating data from various sources such as Twitter and Google Maps – all this without writing a line of code!

Event Agenda Day 2

SharePoint 2010 Communities (Level 200) - Saif 1 Hour
Description: SharePoint 2010 is a huge product that offers an array of features. In this session, I will talk about the features that empower the communities. I will talk about the new social media features introduced by the Microsoft. This includes tagging, bookmarking, people search, expertise search, blogs, wikis, etc.

Windows Phone 7: 0 to 60 in no Time (Level 100) - Adel 1 Hour
“If you want to start developing applications for Windows Phone 7 but don’t know where to start from, this session will help you to get on the track in no time.” It will also demonstrate how quickly you can develop, debug and deploy applications.

Animating Business in Blend (Level 200) - Joel 1 Hour
Discusses how to use animation to enhance line of business applications and demonstrates how to create and employ them in Blend. Topics will include Animations, Triggers, Events, and the Visual State Manager.

SharePoint 2010 - Document Management - (Level 100) - Jerry 1 Hour
In this session Jerry will provide hands on demo of the SharePoint 2010 document management features. This will include Document and Records Management, Content Type Syndications and Publishing, Document Sets, Metadata Navigation etc.

Software Design Principles (Level 100) - Hammad 1 Hour
In this session we are going to talk about how to tackle inherently complex nature of a software. I am going to show you 'most important principles, tools and techniques you can use to 'combat software entropy'. Together, we will gain an insight in to the heart of the software design. We will talk about the heuristics associated with the software design and architectural patterns and practices. Intended audience of this session in-general includes all the stake holders in software development process i.e. from Developer to Architect to Project and Program Manager and even CTOs and CIOs.
Note: Closing, Q / A and Raffle Draws will be made at the end of both days.

Webinar Registeration Link:


Sunday, October 17, 2010

Friday, October 15, 2010

Are you ready for the SharePoint event tomorrow? (for Lahore based readers)

Hi All,

Thanks to all who registered for the SharePoint event tomorrow. I will see you tomorrow at the event 1 PM sharp. It will be a fun filled, fully loaded with informatioin, interactive session and you are gonna enjoy it. We have gifts for you. Apart from books, T-shirts and DVDs, we will also give away a full licence of DXperience Enterprise software which is worth Rs.1,10,500/-. If you want to learn about DXperience Enterprise, visit following URL:


The product includes the following:

> WinForms Controls (over 100 controls)
> ASP.NET Ajax Controls (over 75 controls)
> WPF Controls (over 15 controls)
> Silverlight Controls (over 20 controls)

Howzat! See you tomorrow!



Event URL: http://sharepointpakistan.eventbrite.com

P.S. Only registered users will be allowed in the event. You are not eligible to attend if you are still on the waiting list.

Tuesday, September 28, 2010

Sales Account Manager - Template for SharePoint 2007

Sales Account Manager

I set up one of the role based templates today. This template can be installed on a single machine as well as multiple machines. I installed it using the second approach. My SQL Server machine is different than my SharePoint server machine. Template comes with detailed setup instructions but believe me installing and configuring it is a cumbersome task. Sales and Marketing people will love this template. I faced some problems during database installation. Setup instructions (Section 2.4 Database Installation, Page 5) tell you to copy MySiteAccountManagerRole.bak file in the following folder:
<Drive name>:Program FilesMicrosoft SQL ServerMSSQL.1MSSQLBackup
I got following error when I ran the osql -E -i MySiteAccountManagerRole.sql:

Copying the MySiteAccountManagerRole.bak to the following folder solved my problem:
<Drive name>:Program FilesMicrosoft SQL ServerMSSQL.2MSSQLBackup
Another problem that I faced was that I couldn't find the .odc file mentioned in Section 2.7.3 Document Library Settings - Step 4 and therefore, I had to update the .odc connection file manually.
Here are some screen shots of the template:

Screenshot 1

Screenshot 2

Screenshot 3

Screenshot 4

Monday, September 27, 2010

SharePoint Document Puller v4.0

Download SharePoint Document Puller v4.0


SharePoint Document Puller is a tool to extract documents from the SharePoint's DB. It works with SharePoint Portal Server 2003 (and WSS 2.0).

I have made several changes in this version. There were requests for new features. I have tried to include everything that people requested. The only thing you will find missing is a progress bar or a status  bar that displays the download status.


Version 1.0
Version 2.0
Version 3.0


You see a configuration screen when you run the application for the first time.

Use this screen to add your database connectivity details. Select server from Server dropdown. Click (Re)Load to populate the Server dropdown if it's empty. Add Username and Password and click Connect. This will populate the Database dropdown. There is a possibility that some one is using different databases for different instances (portals) of SharePoint. Select the database from the Database and click the Save button. This will save the configuration and next time, you start the application, you will be taken directly to the Download Documents screen. You can also add a connection string. Select the second radio button to enable the text box and add the connection string and click the Save button to save the configuration.

Shortcut keys

Key Functionality Screen
Ctrl+1 Download Documents  
Alt+O Download Documents  
Ctrl+2 Download Libraries  
Alt+E Download Libraries  
Ctrl+3 Configuration  
Alt+C Configuration  
Ctrl+4 About  
Alt+A About  
Alt+S Select All Items Download Documents
Alt+D Copy Directory Structure Download Documents
Alt+B Browse Download Documents
Alt+V View Documents Download Documents
Alt+P Pull Document(s) Download Documents
Alt+S Select All Items Download Libraries
Alt+D Copy Directory Structure Download Libraries
Alt+B Browse Download Libraries
Alt+V View Sites Download Libraries
Alt+P Pull Document(s) Download Libraries
Alt+L (Re)Load Configuration
Alt+C Connect Configuration
Alt+S Save Configuration

Download Documents

Click View Documents to populate list box with the documents. Select a destination and click Pull Document(s) to download all documents to your hard disk. Check Copy Directory Structure checkbox if you want to copy the directory structure of each file. Similarly, if you want to download complete libraries, select Download Libraries from the menu bar. List box will show you all the libraries that have documents. Select the libraries you want to download, select a destination and click Pull Document(s). Application searches almost all types of files including .doc, .xls, .mdb, .pdf, .gif, .jpg, etc.

Download SharePoint Document Puller v4.0

Published Friday, December 29, 2006 9:41 PM by ssa

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS



Krishna said:

Exactly what i was looking for! Thank you so much!

December 29, 2006 8:52 AM

Neha said:

Excellent tool! Its so easy to use. Can I download PPT files with this tool?


December 29, 2006 8:53 AM

grayghost said:

Interesting.  So it's a GUI version of the export tool included in Keith Richie's SPUtiliSuite?
December 29, 2006 9:17 AM

William V. said:

I am setting up my company's departments in MOSS. This tool will come in handy for downloading and archiving documents uploaded by thousands of users across the company that is scattered in 5 countries. I just tested it with 2003. I like the directory structure feature. It helps when archiving documents as separate zip files. Excellent tool! Thank you.
December 29, 2006 9:47 AM

ajaxspider said:

I need a similar tool for MOSS
December 29, 2006 9:48 AM

ssa said:

Hi Grayghost,

I didn't know that Keith's utility suite had a similar tool included. Although i tested a couple of utilities from his suite months ago but didn't notice the tool you are talking about. I would like to check that out! :)


December 29, 2006 9:51 AM

Ramba said:

I just need a list of all files in the sharepoint. It would be nice if you include a feature to publish a list of files available in sharepoint.


December 29, 2006 9:53 AM

ssa said:

Hi Ramba,

I wrote an application years ago :) that did exactly what you are looking for. That application is still available somewhere on my blog. Just search my blog for keywords like explorer, sharepoint explorer. That application generates an excel sheet as an output.


December 29, 2006 9:56 AM

David Moore said:

Nice tool!
December 29, 2006 9:58 AM

David Moore said:

Nice tool!
December 29, 2006 9:58 AM

Geena said:

I dont know password to the sql server. how can i use the connection string?
December 29, 2006 10:12 AM

David Moore said:


Try using the trusted connection in the connection string. See the second figure in the post. It contains the connection string! ;)
December 29, 2006 10:14 AM

Geena said:


Thanks for the help. :) you r genius!
December 29, 2006 10:16 AM

Joseph said:

can we archive these documents without downloading?
December 29, 2006 10:17 AM

grayghost said:

I want to say that the utility is named SPExportWeb which goes and basically dumps the site to the filesystem.  Comes in handy :)
December 31, 2006 12:45 AM

ssa said:

Thanks for the info grayghost!
December 31, 2006 1:41 AM

Remco Ploeg said:

Good job, great tool!
January 3, 2007 9:30 AM

decatec said:

Thanks .... this tool will be perfect for content migrations
January 7, 2007 8:33 AM

ssa said:

Thanks Remco!
January 9, 2007 5:48 AM

ssa said:

Thanks Decatec!
January 9, 2007 5:49 AM

Alberto said:

Fantastic! Thanks!! Is a great tool!
Now, i have a question... and if someone (I... for example) wants that the documents in a site are download and after delete from the site every 5 days... do you know a method for do it?
January 11, 2007 3:02 AM

ssa said:


Thanks for liking the tool. You are suggesting a new feature! :) Yes, of course, you can do it. With some extra programming this can be done! I will try to incorporate this feature but it will take time.


January 12, 2007 12:40 AM

Alberto said:

Thankt to you.
If you want a help perhaps I can avail you.
I don't know the SharePoint architecture but I have knowledge of SQL Server and some language of programming (Java, VB, C, ASP) ...
In each case i attend your new solutions. :)

January 12, 2007 4:25 AM

ssa said:

Thank you very much Alberto! Thanks indeed for the help offer! My next goal is to create a similar tool for the latest SharePoint server (MOSS 2007).


January 12, 2007 9:03 AM

MOSS 2007 and Code Access Security
Have you ever written a web part or a web service? If yes then you must have dealt with a security problem. Writing a web part or web service may not be a big issue but deploying them is certainly a headache. You start getting permission errors as soon as you deploy your code on the server. I recently wrote an article demonstrating the web service creation process and I promised in that article that I would write about Code Access Security (CAS) in another article. There are three ways to assign execution permissions to your code:
1. Increase the trust level for the entire virtual server
2. Create a custom policy file for your assemblies
3. Install your assemblies in the GAC
In the article, we installed our assembly in the GAC but the safest method is to create a custom policy file for the assembly. Following article on MSDN contains complete details on code access security:
Written in July 2003, this is one of the most comprehensive articles written on "SharePoint and Code Access Security".
For security reasons, the assembly must be installed in the bin directory of the application instead of GAC but installing it in the bin directory requires you to assign execution permissions to the assembly. One way is to increase the trust level of the entire virtual server. This is easy to implement but this option is least secure as it affects all assemblies used by that virtual server. Second way is to create a custom policy file and this is the recommended approach. This option is most secure but difficult to implement. In this article, we will create a custom policy file for an assembly (web service assembly) written for MOSS 2007.
Creating a Custom Policy File
1. Go to the following location on the server:
LocalDrive:Program FilesCommon FilesMicrosoft Sharedweb server extensions12CONFIG
2. Make a copy of wss_minimaltrust.config and rename it wss_customtrust.config.
3. Open wss_customtrust.config file using any text editor.
4. Under the <SecurityClasses> element, add a reference to the SharePointPermissions class as follows:

<SecurityClass Name="SharePointPermission" Description="Microsoft.SharePoint.Security.SharePointPermission, Microsoft.SharePoint.Security, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
5. Search for the <PermissionSet> tag where the name attribute equals ASP.NET. If you couldn't find that <PermissionSet> tag, locate the one that has SPRestricted in the name attribute.
6. Copy the entire tag and all of its children, and paste a copy of it immediately below the one you copied.
7. Change the name of the PermissionSet element from ASP.NET (or SPRestricted) to CustomTrust.



8. Add the following <IPermission> node to the <PermissionSet> element where the name attribute equals CustomTrust:

<IPermission class="SharePointPermission" version="1" ObjectModel="True" />
Therefore, the resulting customized <PermissionSet> will look as follows:
<IPermission class="AspNetHostingPermission"
="1" Level="Minimal"
<IPermission class="SecurityPermission"
="1" Flags="Execution"
<IPermission class="WebPartPermission"
<IPermission class="SharePointPermission" version="1" ObjectModel="True" />
9. Once you define the customized element, you must create a code group to specify when the CLR should apply the permission set. (For details, see the original Microsoft article). Locate <CodeGroup> tag where the class attribute equals FirstMatchCodeGroup and copy following CodeGroup immediately below it:

<CodeGroup class="UnionCodeGroup" version="1" PermissionSetName="CustomTrust">
IMembershipCondition class="UrlMembershipCondition" version="1" Url="$AppDirUrl$/bin/*" />
The membership condition for this new code group is based on URL membership and the URL points to the bin directory. The permissions will be applied to all the assemblies in the bin directory of the current application. You can also use strong name membership but then the permissions will  be applied only to one assembly. For example, if I have written a web service and I wanted to assign permissions to my assembly only, I would use strong name membership. Copy following code immediately below the <CodeGroup> tag where the class attribute equals FirstMatchCodeGroup, if you want to use strong name membership:
<CodeGroup class="UnionCodeGroup"
<IMembershipCondition class="StrongNameMembershipCondition"
Name="UploadService" />
Replace PublicKeyBlob value with your own value and change the name of the assembly in the Name attribute. Name attribute contains the name of the assembly. To retrieve the public key blob for an assembly, use the secutil.exe tool. Please note that publickeyblob is different from publickeytoken. Secutil.exe is located in the following folder:
LocalDrive:Program FilesMicrosoft Visual Studio 8SDKv2.0Bin
To retrieve the public key blob for your assembly, either copy the secutil.exe tool to the folder that contains your assembly else provide exact path to the assembly in the command, and run the tool as follows:
secutil.exe -hex -s UploadService.dll > blob.txt
UploadService.dll is the name of the assembly. This command will create a text file named blob.txt. Open blob.txt and copy the public key and paste it in the publickeyblob attribute.
10. Save and close the file. The policy file is ready to use.
11. Open the web.config file for the virtual server where you have deployed your component and add the following <trustlevel> tag to the SecurityPolicy element:
 <trustLevel name="WSS_Custom" policyFile="LocalDrive:Program FilesCommon FilesMicrosoft SharedWeb Server Extensions12configwss_customtrust.config" />
Virtual Directories for web applications are located in the following folder:
Suppose I want to deploy my web service in the web application configured at port 17316. The URL of that application would be http://localhost:17316/ and its virtual directory will be:
Create a bin folder in this path and copy your assembly to the bin folder. The web.config for this virtual server will be located in the following folder:
In the web.config file,  change the <trust> tag so that it refers to the newly defined trust level.
<trust level="WSS_Custom" originUrl="" />
12. Save and close the web.config file.
13. Restart IIS to apply the custom policy to the specified virtual server.

Di niente, di meno, sul mondo dell'informatica.... said:

January 25, 2007 8:20 AM

Di niente, di meno, sul mondo dell'informatica.... said:

January 25, 2007 9:49 AM

deeptyranjan said:

It will be very much usefull if it will display all the detail and complete structure of MOSS 2007 object model

SharePoint 2007 Object Model

It's very urgent  !!!

If anybody have any Idea Please let me know.
February 8, 2007 3:30 AM

Ryan said:

This was very helpful. After following the steps listed in your post I get the following exception when running my application:

"System.IO.FileLoadException: The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047)".

Any ideas?

February 9, 2007 2:05 PM

ssa said:

Hi Ryan,

Thanks for reading and liking the article. The error you are getting has nothing to do with the code access security. This error occurs when path to your assembly is longer than 255 characters. Make the path shorter to get rid of this error. There are a couple of good links on google that discuss this issue in detail. Here are a couple of links for your convenience:

Hope this helps. Let me know if this does not solve your problem.

Good luck


February 10, 2007 2:38 AM

Abhishek Agrawal said:

It is very useful and comprehensive article for deploying/developing ASP.NET application in sharepoint
February 13, 2007 5:26 AM

Pedro Rainho said:

I have used your Sample Custom Policy File and i have looked at the microsoft site and i'm still having the same problem. i'm doing this in my sample webpart

using (SPSite site = SPControl.GetContextSite(HttpContext.Current))
                   ServerContext context = ServerContext.GetContext(site);
                   SPWeb ferias = site.AllWebs["Ferias"];
                   site.AllowUnsafeUpdates = true;
                   ferias.AllowUnsafeUpdates = true;
                   ferias.Lists.ListsForCurrentUser = true;
                   SPList feriasConfiguracao = ferias.Lists["FeriasConfiguracao"];

                   SPListItem item = feriasConfiguracao.Items.Add();

                   item["Nome"] = "Nome1";

                   item["Valor"] = "Valor1";


it's simple insert an item in a list, and the error continues to be:
Request for the permission of type 'Microsoft.SharePoint.Security.SharePointPermission, Microsoft.SharePoint.Security, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c' failed.

i have simple created a webpart and copy the dll to the bin folder and when i use the web part i receive that error. Any ideas????
February 13, 2007 6:30 AM

ssa said:

Thanks Abhishek
February 13, 2007 8:57 AM

ssa said:


Did you install the assembly in the GAC?
February 13, 2007 8:58 AM

Anders Rask said:

Hi, thanx for the article.

A comment though:

Wouldnt it be better (read more fine grained) to use the assembly name instead of the blob?

Using the blob will give access to all assemblies signed with the same SNK file.

Using the name will give you more control on what assemblies are allowed higher privileges -and IMHO thats what CAS is all about ;-)
February 13, 2007 10:19 AM

Anders Rask said:

Ahh sorry, i just saw you specified both blob and assembly name :-D
February 13, 2007 4:26 PM

ssa said:

Thanks for commenting Anders! :)

February 14, 2007 1:39 AM

Pedro Rainho said:

No, i don't want to install in the gac, i want to copy dll to bin directory, install in the gac is't the same as give full trust in the web.config and i don't want that. If i give full trust my webpart works fine but that is not recomended by MS. i just want to create a simple Custom Policy File that runs the example i posted before.
February 19, 2007 9:21 AM

Suleman said:

Your both articles (MOSS 2007 and Code Access Security & Creating a Custom Web Service for SharePoint ) are really good, the way you described, steps, is simply great.

I'm facing a problem, if you have some solution please let me know and thanks in advance.

I have deployed a simple web service (that returns "Hello world")  on "Server2" then deployed a webpart on "Server1" and call the service from "Server2" it throws an exception "401 Unauthorized ......" when I use Default or Default Network Credentials. e.g.

Web_Ref.PagesList listService = new Web_Ref.PagesList();
listService.Url = siteURL + "/_layouts/KPMGTestService/pageslist.asmx";
listService.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials;
listService.PreAuthenticate = true;

but when I pass userName and password to Network Credentials it works fine. e.g.

System.Net.NetworkCredential ntCred = new System.Net.NetworkCredential("UID", "Pwd", "Domain");
listService.Credentials = ntCred;

My Problem is, I want to use DefaultCredentials or DefaultNetworkCredentials because in my actual webpart somehow i don't wanna impersonate or pass any UID and Pwd etc because i need to check user rights in webservice.

Note: this service works fine if i called it using a Console application.

If you have any Idea, please let me know here in this blog or if you can mail me , that will be great, at suleman.ibrahim@hotmail.com

Once again Thanks.
February 19, 2007 3:56 PM

ssa said:

One thing, the line listService.PreAuthenticate = true; should come before the "credentials" line. Like this:

listService.PreAuthenticate = true;
listService.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials;

Second thing, make sure the login you use for logging in has approp. permissions in SharePoint.
February 20, 2007 4:22 AM

ssa said:


Which method of authetication are you using in the custom policy file? the URL method OR the blob method??
February 20, 2007 4:36 AM

Suleman said:

Yes, the line listService.PreAuthenticate = true; is come before the "credentials" line. It was just an copy pasting mistake.

I have tried both URL and Blob methods in Custom policy file and after updating file I did IISReset but it doesn't work.

Login, I'm using for logging has Administrator rights on both servers and has site Collection administrator rights on both portals.

One thing more, if I make changes in my service should I create disco and wsdl files again or that is not necessary And what is the imapct of these files cuz I tried my service without these files but result doesn't change wheather I have deployed these files or not.

Thanks for your time.
February 20, 2007 8:37 AM

Suleman said:

The problem has been resolved actually we should have to use "Kerberos" Authentication Settings instead of "NTLM", if we wanna access some remote server Services etc. I dont wanna go into details but if anyone wanna know about it, differences between "Kerberos" and "NTLM", can read following article.

Once again thanks for time and comments.

February 20, 2007 1:48 PM

Suleman said:

But, I still wanna know about my last question.

"if I make changes in my service should I create disco and wsdl files again or that is not necessary And what is the imapct of these files cuz I tried my service without these files but result doesn't change wheather I have deployed these files or not."

February 20, 2007 1:58 PM

ssa said:

If there are no major changes then there is no need to recreate wsdl and disco files, your web service will work fine.
February 22, 2007 4:13 AM

sireve said:


I have a problem with this sentence:

string rol = myweb.RoleDefinitions["admin"].Name;

Webpart "x" seems to be causing a problem .Is not the level of permissions.

Any Ideas?? And Pedro, I have the same problem in other webpart...
Have you got the solution? web.configgg!! :s
February 22, 2007 12:24 PM

ssa said:


What is the error message that you get? Cant tell you the problem without looking at the error first!


February 23, 2007 1:57 AM

sireve said:

Hi, I said you, sorry I'm not explain,
this is the error:

Webpart "mywebpart" seems to be causing a problem .Is not the level of permissions.
(this is a traslation message, my MOSS is in spanish)

February 23, 2007 6:13 AM

ssa said:

hmm.. i guess the web part tries to access an area in SharePoint for which it does not have permissions. wait a minute! What are you creating? a web part, web service or just an application using the object model?

February 23, 2007 10:03 AM

sireve said:

This is an error webpart. But the objective is to obtain the group/rol to which the user belongs, in my example user "admin".. how I get it??

thanks ssa
February 24, 2007 6:15 AM

Paul said:

Great Article!  I was going around in circles for a couple hours befire finding your post.  I walked thru it and presto, my webpart is now showing.  I was getting the same error that Pedro(above) was getting.
(Pedro, in case you haven't resolved your issue.  I believe the key part of the post was to edit the local web.config file and make sure the wss_custom_minimaltrust.config (in my case) has a reference in the security policy section (I'd done most of the edits already, but forgot to tell the local web.config about it ):
<trustLevel name="WSS_Custom" policyFile="C:Program FilesCommon FilesMicrosoft Sharedweb server extensions12CONFIGwss_custom_minimaltrust.config" />
Thanks again,
March 25, 2007 8:20 PM

ssa said:

Many Thanks Paul!
March 31, 2007 1:08 AM

Geo said:

This was very helpful. After following the steps listed in your post I get the following exception when running my application:
The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047).
The only additional part which I am trying to do in my web part is Loading the XML in XMLDocument object using Load method from the local drive.
April 24, 2007 11:06 PM

SPS 2003: Deleting a site completely

This is one of the most frequently asked questions. A user when tries to re-create a deleted site gets an error (Site already exists ... !!). This happens when you delete the link but do not delete the actual site. To delete the site physically, do this:

Go to your site > Site Settings > Go to Site Administration > Delete Site (Under "Management and Statistics")

To remove the link, do this:

1. Go to site directory (sites area) > Manage sites

Find your site in the list, open the context menu (click the down arrow (drop down)) and select "Delete Item".

Now, your site is deleted and you can create it again with the same name!



MOSS 2007 Installation Guide

Installing Microsoft Office SharePoint Server (MOSS) 2007
I have been thinking of writing a small installation document for MOSS 2007 since the beta 2 was released. There is always shortage of time. I have noticed that even though B2TR is available for download but many people are still struggling to install the beta 2 that was released a few months ago.
MOSS 2007 Beta 2 Technical Refresh can be downloaded from the following page:

and instructions on how to install this TR are available on SharePoint Team's site:

I would recommend that you install MOSS on a fresh machine. You can install it on a virtual machine. I have tested it with VMware. Hardware and software requirements are listed on the following page:

You should have at least 2.5 GB space free on your hard disk and at least 1 GB RAM for good performance. On my machine, it took approx. 2.3 GB to install SharePoint, WinFX, SQL Server and i spent approx. 1 and a half hour in installing all these products.
1. Install IIS 6 with ASP.NET enabled.
2. Disable Internet Enhanced Security in IE 6. You can disable it by going to Add/Remove Windows components.
3. Install SQL Server. I have tested MOSS 2007 with both SQL Server 2000 and 2005. If you are installing SQL Server 2000 then make sure you install SQL Server 2000 Service Pack 3 as well.
4. The file downloaded from Microsoft is in ISO format. You can download ISOBuster or any other ISO software to extract setup files from the ISO image. I would recommend WinRAR. There is a problem with other ISO software. You get "Language not supported" error during installation. The solution to "Language not supported" error is to use RAR instead of ISO software. Simply, change the extension of the downloaded file to .RAR and then use WinRAR to extract files from the ISO image.
5. Download WinFX from the following page:

Be careful with the version of WinFX. Versions earlier than this won't work with MOSS 2007 and will give you an error during the MOSS installation. You should only download the following version:
File Name: winfxsetup.exe
Version: 3.0.3906.22
Date Published: 5/23/2006
Language: English
Download Size: 2.5 MB
Run winfxsetup.exe downloaded from the location shown above. Winfxsetup.exe will download more files from the internet and it can take around 30-40 minutes for the setup to complete. This includes downloading 46 MB of data from the internet. This will install the components required for the MOSS setup.
6. Run the SharePoint setup file to start the installation. You will be asked to enter the license key.
Enter your license key and click the "Continue" button.
7. Next screen, you will be asked to accept the license agreement.
Click the checkbox and "Continue" button to proceed.
8. In next screen, you will be asked to select "Basic" or "Advanced" setup. Select "Advanced".
9. Select "Complete" installation type in the next screen. The other two options are:
- Web Front End
- Standalone
Click "Install Now".
10.  Installation will start and you will see a blue progress bar.
It will take approx. 10 minutes for the installation to complete. You will see following screen when your installation is complete:
Now your SharePoint installation is complete and it's time to configure the application. Check the checkbox and click the "Close" button. You will see another screen:
Click "Next" to start the configuration process.
11. You might see the following message when you click the "Next" button:
Click "Yes"!
12. In the next screen, you will be asked to select a server farm. Click "No" to create a new server farm and click "Next".
13. Enter your database server and database name in the next screen which looks like this:
Also, enter username and password that will be used to access your database. I used my local Admin account. Click "Next" to proceed.
14. Select security options. You can change the port number and security configuration in this screen:
I selected the default options. Click "Next".
15. You will see the following screen:
Click "Next" to proceed.
It will take sometime for the configuration to complete. You will see a progress bar during the configuration process:
16. Finally, you will see the "Configuration Successful" message. Click "Finish" and you are done!
Here is the first screen that you will see after configuration:
Congratulations! MOSS 2007 has been setup.