Friday, October 28, 2011

Create Custom Site Collection Web Service

Some time ago i needed to access to "Site Collection" information by Web Services. This type of Service is not able by SharePoint, not because is hard, but maybe for Security and Performance issues, 
I was making some investigation about the content of different SharePoint Site Collections and didn't have access to Central Administration for the API for that i try to use this Web Service to return some information that, since i am not able to use Out of the Box Web Services to response this requirement...

PS: Be careful with SharePoint Service Pack and CU and Security update that can change the API permission and block access to Site Collection content. Use by your own risk.

Validate if the user you will use to call all Site Collection have access to you Web Application with Read Permission,
For this, you can access you Central Administration
Central Administration > Application Management > Manage Web Applications > Select Web Application > Click on Ribbon "User Policy"

Validate if the account you will use have Full read Permission to access the Site Collection Content.

Create the Web Service

You can create your own Custom Web Services following  the MSDN Article:
Walkthrough: Creating a Custom ASP.NET Web Service SharePoint 2010

For this example i create a VS2010 Studio Project and add a Custom Web Service to return some Site collection properties, this Web Service will be mapped to be deployed in the Folder "ISAPI" you can find in the SharePoint installation folder "14"

Here example code to call the Site collections:
                SPWebApplication webApp = SPContext.Current.Site.WebApplication;
                SPSiteCollection siteCollections = webApp.Sites;
                foreach (SPSite siteCollection in siteCollections)
                         //Return Some Site Collection Properties...
                        if (siteCollection != null)

To deploy this solution in your SharePoint Farm you can use the PowerShell commands  in "SharePoint 2010 Management Shell"
  • Add-SPSolution -LiteralPath <SolutionPath>/WebServiceSiteCollections.wsp
  • Install-SPSolution -Identity WebServiceSiteCollections.wsp -GACDeployment

Test the Web Service with SharePoint Designer

To validate if the Custom Web Service is accessing without problem you can make the call  with "http:/[Site]/_vti_bin/CustomSiteCollection.asmx"

One simple way to test this Custom Web Service, can be using SharePoint Designer 2010 and add a Data View Web Part to a SharePoint Page.

The first task is create a Data Source to our custom Web Service and select the Method List Site Collections.
This Data Source will be stored in the Data Sources List on the Left.

After you create your Data Source you can use in your SharePoint Page to display the Data associated, for this you can Edit a aspx page example:"Home.aspx" access to a Web Part Zone and select on Ribbon "Insert > DataVew > CustomSiteCollection".

A new View call "Data Source Details" will appear in the right with the SOAP Field of the Web Service, you can select  the field to Display and create a DataView of the Content.

After you change the Layout of your xslt in the Data View and save the page, preview you SharePoint Page and view you content displayed.

 If you are having issues accessing validate the permission requisites

Custom Site Collection Web Service Solution Link,

Hope you like...



Wednesday, October 26, 2011

SharePoint 2007, Wss3 and SP Designer SP3 have been released

After a long waiting Microsoft have been released the Service Pack 3 for Windows SharePoint Services 3.0 and SharePoint 2007 Office Server SP3.
This also include SharePoint Designer SP3

You can download and see all the information about this Service Pack in the following Links:

Description of Windows SharePoint Services 3.0 SP3 and of Windows SharePoint Services 3.0 Language Pack SP3

Description of the 2007 Office Servers SP3 and of the 2007 Office Servers Language Pack SP3 

Description of Office SharePoint Designer 2007 SP3 and of Office SharePoint Designer Language Pack 2007 SP3

SP3 Warnings:

October 2011 CU for SharePoint 2007 has been re-released

Thursday, October 20, 2011

How to get SharePoint Home Page URL without SharePoint API

This is a hint on how you can use .Net to get SharePoint Home Pages using .Net Code.

I was making a application to return all Sites and Sub-Site and the question came to my mind "What is the HomePage url for each Site?"

You don't have access to Server SharePoint API and you need to get the Home Page for each SharePoint Site.

When you list the Site Collection or Sub Sites on the SharePoint Site "can be using Out of the Box Web Services Webs.asmx" you will have something like this:
  • http://[site]
  • http://[site]/Sites/example1
  • http://[site]/Sites/example2
  • http://[site]/Sites/example3

But you don't have the Home Page url associated for each sub Site or Site Collection,

For example if you use a normal SharePoint 2010 template the default page is 
  • http://[site]/SitePages/home.aspx
SharePoint 2007 Template was:
  • http://[site]/default.aspx
If you use Publishing Template you will have something like this
  • http://[site]/Pages/default.aspx

One way to manage the Home Page for each site is using SharePoint Designer 2010.

Since we cannot assume the same default homepage and Hard code url is not a good Solution we can use the .NET Framework to get the HomePage associate for each Site...

Example with code:

HttpWebRequest httpWebrequest;
HttpWebResponse httpWebresponse;

//Create a request for the SharePoint Site
httpWebrequest = (HttpWebRequest)WebRequest.Create("url site example, https://example/sites/example1");
//Associate the correct Credential to you SharePoint Site
CustomCredential.Add(new Uri("url site example, https://example/sites/example1"), "NTLM", new NetworkCredential("UserLogin", "Password", "Domain"));
//or you can assume the current local Credential to authenticate
CustomCredential.Add(new Uri("url site example, https://example/sites/example1"), "NTLM", System.Net.CredentialCache.DefaultCredentials);
 //If you don't have the credentials you will get error 401

// Assume the credentials to you request
httpWebrequest.Credentials = CustomCredential;  
httpWebresponse = (HttpWebResponse)httpWebrequest.GetResponse();

//Get the Homepage associate to "https://example/sites/example1"
String HomePage = httpWebresponse.ResponseUri.AbsoluteUri.ToString();

//Popup a message with the HomePage url

For this example i create a application to list all Site Collection and Sub-Site and popup the HomePage of each one.

Hope you like... :)

Saturday, October 15, 2011

Add Multiple Browsers Preview in SharePoint Designer 2010

When we are creating SharePoint Site with custom Branding that have a lot of JavaScript and CSS there are a lot of validation we need to do for each Browser, one of the requirement from Company's is validate  list of Browsers, what is normal when we create SharePoint sites for Internet.
The problem of having multiples Browser each of them have different protocols and different ways each Browser manipulate the same Html...
SharePoint Designer have a option to preview your SharePoint Page, but by default is associate to Internet Explorer but you have the ability to associate the multiple Browser to preview the page in a very way.
To  add new Browser in your "Preview in Browser" option you will need to select "Ribbon > Preview in Browser > Edit Browser List".

To add a new Browser reference you need to select option "add" and "Name" and "Command" associate to your Browser.
Here some references i use do add some Browsers:
Chrome Browser
"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
FireFox Browser
"C:\Program Files (x86)\Mozilla Firefox\firefox.exe"

After made the reference to each Browser .exe you can use the Option on SharePoint Designer "Ribbon > Preview in Browser" and select the Browser you want to display the SharePoint Page you change and evaluate the behavior. 

Below you have a link from Microsoft about the Browse support SharePoint Sites:
Plan browser support (SharePoint Server 2010)

Hope you like :)

Thursday, October 13, 2011

Retention Policy Document Library (Beginner)

One of the good features we can use with SharePoint is the Retention Policy associated with Content Types and Documents types

Simple Example:
Company ABC have a Library with a lot of photos of the employes, this folder was grounding bigger every day to manage this folder the Company define a Policy that each picture with more then 1 Months need to be deleted.

Microsoft SharePoint Out of the Box already bring a tool to manage this type of Policy, in this case, you need to go into "Pictures Library Settings" and "Information Management Policy Settings"
 from there you need to select what content type you need to manage the Policy in this case "Picture"

When we select the option "Enable Retention" a new option will appear to manage the retention policy.

From here you can define the Events and Actions that will be associated to your policy,
In this case you need to define the "Time Period" to 1 Month and associate a Action, for this case i don't select "Move to Recycling Bin". Why? If you move pictures to Recycling bin and if you have Site Quota very low, that can have impacts and block you site when you reach the Site storage Limit, for this i choose "Permanently Delete". and is done... very easy and you can also create custom Workflow to create alerts for Reporting reason and also use the record management for repository... Retention Policy is very usefull very cool feature, you will like.... :)

If you want to create custom Retention Actions you can have this example from Microsoft
"Creating a Custom Expiration Formula Based on Metadata in SharePoint Server 2007"
and from "Yaroslav Pentsarskyy"

Hope you like :)

Tuesday, October 11, 2011

uCertify Exams PreKit evaluation

Some time ago uCertify, a certified company to prepare IT person for exams from different company's like "Microsoft, Oracle....", they invite me to review their product to prepare for SharePoint 2010 exams, in this Case for Microsoft Exam 70-668 PRO: Microsoft SharePoint 2010, Administrator.

I have to admit, i didn't have a lot of time to review their product until last weekend.
I was surprised with the quality of their product and how they prepare the training and provide the information.

I found it very intuitive to manage the different exams with the uCertify application.
The application have a lot of features to help you prepare for the exam, will a lot of Articles an tips to help.
The ability to create your own exams with a lot of possible question, a lot of them.... helps the user to create different type of exams and area knowledge about SharePoint 2010, this is really good...
When you are making the different test you have a real simulation of the exam with the time consumed and review associated to each question.
You can also give the feedback of each question or ask for help for other users (Collaboration)... "that i never see before" :)
Each exam is stored that will be use later for review and statistics, this make the user easy access for review and correction their exams.
There is a step by step for each question and answer associated with description, this will help you understand where was your mistake and how you can correct.

There is one thing that bored me, the questions... But i have to be fair, i already made a lot of exams on Microsoft and the questions are very hard to understand without a context, that's always confuse me, but the most interesting the Ucertify, following the same type of question as Microsoft, that is very good with this exams you can always have a picture what type of questions you can find on Microsoft Exams.

As final result is a good and useful training tool to prepare for the Microsoft SharePoint exams.
Remember there is a lot of previous study and uCertify provides a lot of content to prepare for exams and questions about SharePoint 2010 Administration you just didn't know...

Monday, October 10, 2011

Windows Powershell Builder for SharePoint 2010 and Office 365

Microsoft launched one Internet tool to help SharePoint  IT/Dev to help create their Powershell Scripts using Silverlight Application, this tool can be found in this Link: Windows Powershell Builder for SharePoint 2010

You can see the manual here:
Windows PowerShell Command Builder Getting Started Guide

Another useful tool provided by Microsoft will help a SharePoint IT and Developer to send their application and manage the SharePoint sites.

That is great :)

Tuesday, October 04, 2011

Using Search Web Services

This Post is a continuation of last on on how we can use SharePoint OoB Web Services to search not only for document but also create filter and query like filter File Extension "Aspx" pages that could have Web Parts or refine our searches.... 

For this Project i use a external tool to help me make Query's in existing Scopes

also add the url http://[Site]/_vti_bin/search.asmx

The SharePoint Search uses Scopes, each one will have rules used to index content of SharePoint and not SharePoint Sites.
As developer or SharePoint Site administrator you can use SharePoint Default Services to collect information and used to display and for this example i will use the Search Scope "All Sites".

The Search Service and scopes to index the SharePoint content Sites has to be configured...

Query example:
SELECT Title, Rank, Size, Description, Write, Path,FileExtension 
              FROM Scope() WHERE  ( ("SCOPE" = 'All Sites') )  
                        and FileExtension ='aspx' 
                        and contains(Path,'"http://[Site]/"')  ORDER BY "Rank" DESC ]];

  • portal..scope() WHERE  ( ("SCOPE" = 'All Sites') ) 
    • This parameter will make the filter to the Scope "All Site you can use "
  • FileExtension ='aspx' 
    • This parameter will make the filter to all "aspx" Page
  • contains(Path,'"http://[Site]/"')
    • This parameter the make query to refine or restrict the access of the content, in this case i use the url,can be Site collection URL or even to the List. Example: contains(Path,'"http://[Site]/Lists/Contacts"') to return aspx file where are store the WebPart Pages...
We can refine more our query to return the exact aspx page with "

If we select to execute the Query will return all the aspx page that could have WebParts.
The Below image is a test that returns all types of documents.