Dec 18, 2012

SharePoint 2013 Certification

Below is the links to know about initial release for Certifications in SharePoint 2013:

Exam 70-331: Core Solutions of Microsoft SharePoint Server 2013 http://www.microsoft.com/learning/en/us/Exam.aspx?ID=70-331

Exam 70-332:Advanced Solutions of Microsoft SharePoint Server 2013 http://www.microsoft.com/learning/en/us/exam.aspx?ID=70-332


Dec 12, 2012

Web Part with Custom Tool Part in SharePoint

To know about Basics of Creating a Custom Web Part with Validations and Deploying it in the SharePoint, read this article.

In this article, we will know how to create a custom web part in SharePoint with Custom Tool Part (Custom Properties).
Before creating a custom web part with custom tool part, we will know about the basics of Custom Tool Part in SharePoint.

What is custom tool part?
The Custom tool part is part of the web part infrastructure, which helps us to create a custom user interface for the web part properties which is different from default property pane.


Difference between Standard Tool Box and Custom Tool Part Properties
Below is the difference between the Sandbox and Custom Tool Part properties in a web part:
Sand Box Tool Box Properties:This is the tool box that comes by default and it contains Text Boxes, Check Boxes and Drop down lists to fill or select the data. But this tool box does not contain any dynamic controls for displaying the dynamic data from the SharePoint list or libraries. This is something like hard coding the values in the .cs file of the web part.
Custom Tool Part Properties:With the Custom tool part or tool box can contain any asp controls in it and it can bind the data to from the database or list and libraries. Hence displaying the dynamic values or data is possible using this tool box.

List of attributes used for creating a Custom Tool Part

Two Classes used in the Web Part Tool Pane Creation
WebPartToolPart – represents a tool part that can be used to show and modify Web Part base class properties.
CustomPropertyToolPart – used to show and modify the custom properties created in the web part.

Please feel free to share your thoughts and share this post if it helps you!

How does Ribbon in SharePoint 2010 works?

A file called CMDUI.XML stays at the web front end which contains the Out-of-Box site wide Ribbon implementation i.e. all the Ribbon UI for the entire site. In addition to this you have a CustomAction for each ribbon component.

These CustomActions have CommandUIExtentions block which has CommandUIDefinitions and CommandUIHandlers which make up the activity of the ribbon component.

So, when the ribbon is loaded the CommandUIDefinition merges with Out-of-Box definition in the CMDUI.XML

Dec 11, 2012

Consuming a web service using ASP .NET

To know about basics of web service read this article.
To know about creating a web service using ASP .NET read this article.

Background:
In the previous article we have learned about creating a web service. Now in this article, we will learn how to consume a web service using asp .NET.
Real Time Example:
Nowadays mobile application (Mobile Apps) are used widely all the users. Take a scenario, we install the “Weather” gadget in our mobile and check the weather of a particular place.
Think where we are receiving this weather information? It is actually we are consuming the web services.
We will select the region/place to see the weather, a web service will be called and the weather info is displayed.
Hence, Web Services are hosted somewhere and via internet we are consuming the data through the web service.

Implementation:
1. Create an ASP .NET web application with a simple design as shown below:
2. Now, we have to add the web service reference to this Project (Here we use the web service created in the previous article). Click on the Projects in solution explorer -> Add web reference -> give the url of the web service
(Note: to access the web service in the client use the appropriate machine/domain name)
Now, you will see the following screen:
3. Click on Go and search the web service and then give the web reference name say “Consume Service” in our example. Then click Add Reference button.
4. Now, in the solution explorer you will see the Web Reference being added as shown below:
5. We can use the methods exposed by the web service in our code and test the result. Sample code is shown below:
public partial class _Default : System.Web.UI.Page 
{
   protected void Page_Load(object sender, EventArgs e)
   {
   }
    protected void btnToCelsius_Click(object sender, EventArgs e)
    {
        double x = Convert.ToDouble(txtValue.Text);
        if(txtValue.Text != string.Empty)
        {
            try
            {
                ConsumeService.Service service = new ConsumeService.Service();

                lblOutput.Text = service.ToCelsius(x).ToString();                
                
            }
            catch (Exception)
            {
                throw;
            }
        }
    }
    protected void btnToFahreinheit_Click(object sender, EventArgs e)
    {
        double x = Convert.ToDouble(txtValue.Text);

        if (txtValue.Text != string.Empty)
        {
            try
            {
                ConsumeService.Service service = new ConsumeService.Service();

                lblOutput.Text = service.ToFahreinheit(x).ToString();

            }
            catch (Exception)
            {
                throw;
            }
        }
    }
}

6. Build and run the code. Test the result by giving some inputs as shown below:

The whole source code can be downloaded from this link.

Hope the three articles about the web services explained about the basics of web services, creating and consuming the web services using ASP .NET in a simple way.
Please free to comment which help me to write more.

Creating Web Service using ASP .NET

To know about basics of web service read this article.

1.   Create an ASP .NET web service application using Microsoft Visual Studio.
2. Take a scenario that we have to convert Celsius to Fahrenheit and vice versa.
3.   Below is the code for our scenario:
using System;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;

[WebService(Namespace = "http://ConversionWebService.org/Temp")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class Service : System.Web.Services.WebService
{
    public Service () {

        //Uncomment the following line if using designed components 
        //InitializeComponent(); 
    }
    [WebMethod(Description = "Convert Celsius to Fahreinheit")]
    public double ToFahreinheit(double C)
    {
        return C * (9.0/5.0) + 32;        
    }

    [WebMethod(Description = "Convert Fahreinheit to Celsius")]
    public double ToCelsius(double F)
    {
        return (F - 32) * (5.0/9.0);        
    }
   }
4. Build and run the web service, you will see the following output:
5.Now, we will test the web service by giving input values and invoke it.Below are the screen shots which will show the input given and the results:


                             
Hope this article, explains you about creating and running a simple web service using ASP .NET
Here is the link to download the full source code.

To know about consuming a web service using ASP .NET read this article.

Basics of Web Services

Introduction:
In this article, we aim at learning the basics of web services and understand how does web service works.
WebService:
1.   Web services are the easy way to create communications between different applications of different platform.
2.  Web Services extend these models a bit further to communicate with the Simple Object Access Protocol (SOAP) and Extensible Markup Language (XML) to eradicate the object-model-specific protocol barrier.

Components of Web Service:
All the standard Web Services works using following components
  1. SOAP (Simple Object Access Protocol)
  2. UDDI (Universal Description, Discovery and Integration)
  3. WSDL (Web Services Description Language)
SOAP (Simple Object Access Protocol):
SOAP is an XML-based protocol to let applications exchange information over HTTP. Simply, SOAP is a protocol for accessing a Web Service.
  1. It is a communication protocol and it is a format for sending messages.
  2. It is designed to communicate via Internet (W3C standard)
  3. It is platform and language independent
  4. SOAP allows you to get around firewalls
WSDL (WebServices Description language):
It is a W3C standard used to describe and locate the web service in XML language format.
UDDI (Universal Description, Discovery and Integration):
  1. It is a directory for storing information about web service
  2. It communicates via SOAP
  3. It is built on .NET platform
Why web service?
  1. Interoperability
  2. Usability
  3. Deployability
  4. Reusability
For more details on the advantages and disadvantages refer this MSDN article: http://social.msdn.microsoft.com/Forums/en-US/asmxandxml/thread/435f43a9-ee17-4700-8c9d-d9c3ba57b5ef

To know about creating a web service using ASP .NET read this article.
To know about consuming a web service using ASP .NET read this article.

Captcha using Java Script

Background:
Now a days, all the web sites requires inputs (contact us, feedback, etc.) from the end users. But many sites face a problem of spam or unwanted or junk messages. To avoid this we have a java script code which will generate the random codes which should be entered by the users manually.
This avoids the spam being automated or entered by the unwanted users being entered in to the site.

Solution:
Below is the code which consists of Java script implemented in HTML page for reference.

Random Message



Below is the screenshot of the same:
Here is the link to download the image and hmtl file. Captcha using JavaScript.
Hope this component helps using it in your website to avoid spam and unwanted messages.

Dec 8, 2012

Create Site Collection in Separate Content Database in SharePoint

Problem:
When a “Site Collection” is created in a web application, then the proceeding Site Collections created in the same “Web Application” will use the Same Content DB.
This creates problems in the following scenarios:
1. Size of the one Site Collection grows large then it will affect the other Site Collection too. The
reason being maximum size of a Content DB for a Site Collection with good performance is 200 GB
(referred some MSDN articles).
2.  During migration/archival/splitting of content DB.

Solution:
The solution for the above problem is to “Create Site Collections with Separate Content DB for each Site Collection”.
But by default SharePoint allows you to create new site collections in the Same Content DB which is used by the web application (one created first – Top Level Site Collection)
Using Central Administration page:
1.   Suppose that we have created a Top Level Site Collection with content DB named “WSS_Content_1000”. Now our scenario is to create a new site collection in the same web application with different content db.
2. Now navigate to Central Admin -> Application Management -> SharePoint Web Application Management -> Content databases
3. By using the option Add a content database in the menu, create a new content DB named “WSS_Content_1050”
 6. Now, you can see the database (WSS_Content_1000) in the stopped state: 
 7. Now, try creating a new Site Collection in the same web application. “Your new site collection will be forced to create in the Content DB which is available in the web application” (in our case it is WSS_Content_1050).
8. Now, change the status of the first content db to Ready state.
9. Now to check whether our new site collection is created in different db’s go to Central Administration -> Application management -> Site collection list. “You can see two site collections in two different databases” as shown below:
     ØTop level site collection created in WSS_Content_1000 db
     ØTop level site collection created in WSS_Content_1050 db


10. As shown in the above screenshot, we are able to create a new site collection with a new Content DB using the above method.

Oct 27, 2012

This item could not be crawled because the repository did not respond within the specified timeout period - SharePoint Search Error

Problem:
Environment: WSS 3.0, Microsoft Search Server Express 2008
The Search server is crawling the contents properly and the search is working as expected. Suddenly, search crawling stopped and the error in the Search log is
"This item could not be crawled because the repository did not respond within the specified timeout period. Try to crawl the repository at a later time, or increase the timeout value on the Proxy and Timeout page in search administration. You might also want to crawl this repository during off-peak usage times".
Solution:
I understood that the error is due to the Proxy and checked the Proxy and Time Out settings in Search Server Administration and it is 120 Seconds.
Then, removed the Proxy Settings configured in the IE. Followed by an incremental crawl fixed this issue and I didn’t see any errors after that.
Also, uncheck the option in the IE “Automatically Detect Settings” (if it is checked).
Here is the link which gave the complete solution for this issue:
Happy Sharing!

Aug 28, 2012

Advantage of PowerShell over STSADM

In SharePoint 2010, new concept called Power Shell is introduced. The main adavantage of using Windows Power Shell over STSADM is follows:
  • Windows PowerShell is built on the Microsoft .NET Framework and accepts and returns .NET Framework objects. Hence, can interact with .Net objects directly.
  • Here we use commandlets (cmdlet) instead of commands. Commandlet is a instance of .Net objects
  • We can automate the tasks using power shell scripts.
  • Windows PowerShell also gives you access to the file system on the computer and enables you to access other data stores, such as the registry and digital signature certificate stores.

Aug 6, 2012

Event ID 28721 in Source cannot be found

Problem:I have faced this problem when I tried to upload a document one of my document library in SharePoint. Neither the upload is successful nor no errors while uploading.
Event Log:I was unable to view any errors with respect to the document upload in the event log. I could see only the following logs in the event viewer:
Event Type: Error
Event Source: Windows SharePoint Services 3
Event Category: General
Event ID: 28721
User:  N/A
Description:The description for Event ID ( 28721 ) in Source ( Windows SharePoint Services 3 ) cannot be found. The local computer may not have the necessary registry information or message DLL files to display messages from a remote computer. You may be able to use the /AUXSOURCE= flag to retrieve this description; see Help and Support for details. The following information is part of the event: #960013: Antivirus scanner timed out.


Following are the investigations done for fixing the errors:
1. Checked the file size limit in the web application general settings – but I have tried to upload only a few KB text file.
2. Checked the SQL server logs and there is enough space for the upload.
3. Created a new document library and tried attaching a new document which is unsuccessful.
4. Created a new list and added an item which is successful. But when tried attaching a document (or text or small file) it is unsuccessful.
Hence, I have concluded that there is no problem with SharePoint or any corruption of document library or list definition.
Looking at the event log carefully, I finally came to an idea that Antivirus is blocking something and it is where the problem is arising.

Solution:1. I have tried changing the Antivirus settings in the Central Administration 
2. Go to -> Central Administration -> Operations -> Antivirus -> Antivirus Settings -> I have unchecked the option Scan Documents on Upload -> Clicked save
3. Now, I have tried uploading the documents in the document library which is successful. Hence, concluding that the problem is due to the Microsoft Fore Front Security Antivirus.
4. Note: But we cannot make this option as default, since without antivirus scan, unwanted files (viruses, malwares, spywares, etc.,) may be uploaded which would be threat to the SharePoint environment.
5. Finally, updated the Antivirus definitions and license for the Fore Front antivirus. Then onwards, the upload is successful and secured one.

Microsoft Fore Front Security Antivirus1.  It is an antivirus provided by Microsoft dedicated to SharePoint environment. It will protect the SharePoint environment from the virus, spywares and other treats being uploaded.
2.  To know about the Microsoft Fore Front Security Antivirus click on this link
http://sharepoint.microsoft.com/en-us/product/Related-Technologies/Pages/Forefront-Protection-2010-for-SharePoint.aspx
3.  In the central Administration -> Operations -> Antivirus -> Antivirus Settings -> Scan documents on upload is set, then all the documents being uploaded will be scanned by the for front and then only uploaded into the SharePoint environment.

Happy Sharing!

Jul 30, 2012

Parser Error Data at the root level is invalid. Line 1, Position 1

I have got this error message suddenly in a (WSS 3.0) SharePoint site. The site is working as expected and it does not throw any errors before.
The error screen shot is below:


From the error message, I could understand that there is a problem with the browser comapatibility.
Solution:
I have navigated to the SharePoint site in the IIS and then explored the files in the IIS.
Then navigated to APP_Browsers folder, there I could see there is a  sub folder named _vti_cnf  inside I could see a file compat.broswer in it. This file (file which mentions the compatible browsers for loading the SharePoint site.) is already present in the root directory.
I have deleted this file (compat.browser) which is inside the _vti_cnf folder and refreshed the site, it worked as before.
Happy Sharing!

The POP3 service could not create the mailbox – the account already exists

In Windows Server 2003, I have configured POP 3 service, created domains and mailboxes.
I have created many users and associate mail boxes in the POP3 service and deleted for some reasons.
When I try to create the same user I have got the error:
The POP3 service could not create the mailbox - The account already exists

Even on manually deleting the folders (mailboxes created for each user created), I got this error.
Reason:
Then I came to know that the user associated with the mailbox is not deleted.
Right Click on My Computer -> Manage -> Administrative Tools -> Computer Management -> System Tools -> Local Users and groups -> Users -> Delete the user account for which you are unable to create the mailbox.
Note: Check the user associated with any other applications or any services before deleting the user.
Now, try creating the mailbox, you will be able to create the mailbox successfully!

Jul 27, 2012

Download Image from Right Click Disabled Website

In this article, we will know a small trick where we can download the images from the web page in which the right click is disabled in the web page.
Usually, web masters will disable the right click on the web pages in order to protect the content in the web page.
But sometimes, we need to download the images or copy the content from the web pages. Following are the different steps:
1. In the web page, only Right Click is disabled. Hence, we will use LEFT CLICK. Point the image and left click on the image and then drag the image to the desktop or to the address bar in the browser. Hurray! You can save the image.
2. In Internet Explorer, we can disable the active scripting and copy the image. The reason behind this is kind of scripting is written using “JAVA SCRIPTS”.Got to IE -> Tools -> Internet Options -> Security Tab -> Custom level -> Go to Scripting -> Active Scripting -> Disable -> Click OK and restart the browser
3. In Mozilla Firefox  the steps is as follows:
Open the browser -> Go to Tools -> Options -> In the Content Tab -> Uncheck or Deselect the Enable JavaScript -> Restart the browser
There are many third party tools which enable to download the images and contents. But the above are the few easy steps to achieve the goal!

Jul 25, 2012

SharePoint 2013

Everyone knows SharePoint 2013 server and SharePoint 2013 foundation has been released with many new features by Microsoft.
 
Here are the few links for the SharePoint 2013 for the start up:  
 Let’s start using SharePoint 2013 and start collaborating more than ever!

Jul 1, 2012

Visual Studio Workflow in SharePoint

Part II
To know about the Basics and Advantages of using Visual Studio Workflow
read this article.
In this article, we will how to Create a Simple Sequential Workflow Console Application.
Steps:
1. Open Microsoft Visual Studio -> File -> New Project -> Select Visual C# -> SharePoint -> Workflow -> SequentialWorkflowConsoleApplication

2.  You can see the required DLL’s added in the solution for running the work flow in the Solution Explorer

3.  From the Toolbox -> Select Code -> drag and drop inside the designer view as shown below. Double Click on the codeActivity1 -> you will be navigated to Code behind page of the solution.


4. I have initialized a variable with get and set methods and activity for the code1 as shown below:

5. Now, go to the Design view -> From Toolbox -> Drag and drop IF ELSE activity and the code activity for IF and ELSE branch

6. Right click on codeActivity2 and click Generate handlers to create handlers the activity and do the same for codeActivity3
7. Now, we will set the condition for the ifElseActivity1 and 2. Right Click on ifElseActivity1 -> Properties -> Condition -> Select Declarative Rule Condition


8. Give the Condition Name and then Click on Expression for setting the condition:
9. Following are the conditions set for both the activities:


10.Now,if you click on any one of the activity -> properties -> select the name
then -> you can see the two conditions being used in the solution as shown:

11. Finally, I have added the message to be returned for the both activities

12. Now build the solution and then execute the code:

Here is the full solution. Click to download. Happy Sharing!
Hope, you have enjoyed this article.
Please free to comment and share this article, if it helps you!
Happy Coding!!

Visual Studio Workflow in SharePoint

Part I
To know about the Basics of Workflow in SharePoint, read this article.
To know about the Creating a Designer Workflow, read this article.
To know about the New Features added in SharePoint Designer 2010, read this article.
In this we will learn about Basics of Visual Studio Workflows in SharePoint.
Windows Workflow Foundation -WWF:
Windows Workflow Foundation (WF) is a Microsoft technology for defining, executing, and managing workflows.
Why Visual Studio Workflow is necessary?
From the business perspective, we need some custom workflows to be designed and developed in order to meet the requirements. By using designer, we cannot achieve all the custom actions and hence Visual Studio workflows are necessary.
Moreover, Visual Studio is a known environment to the developers (working with Microsoft Software’s) and hence the design and development is very easy.
Software Requirements
  Ø  Windows Server 2003 R2 Download
  Ø  Microsoft .NET framework 3.0 Download
  Ø  Windows SharePoint Services 3.0 Download
  Ø  Microsoft Visual Studio 2005 with SP1 Download
  Ø  Windows SharePoint Services 3.0 SDK Download
  Ø  Visual Studio 2005 Extensions for Windows Workflow Foundation Download
   Limitations of using Designer Workflow:
  Ø  A major disadvantage is that, you can create only Sequential Workflows using designer and not the State Machine workflows.
  Ø  We cannot write custom code and custom activities for workflows while creating using designer.
  Ø  Maintenance and upgradeable methods are very less.
To know how to create a sample Sequential Workflow using Visual Studio, read this article Visual Studio Workflow in SharePoint.

Prevent Outlook from Sending Emails with a Blank Subject

Objective:
In the IT Industry, Outlook is most popularly used as the Email client. The subject line is a very important part of any email. Many times has it happened to you that you have sent an email through Outlook without a subject line? After clicking the Send button, you realize that you have made a mistake (What if it is a case you have sent a mail without Subject to a Client or a Manager?)
By default, Outlook does not validate a mail with a blank subject and here is the solution.
Steps:
1. Open MS Outlook -> Tools -> Macro -> Visual Basic Editor
2. You will see Visual Basic Editor will be opened 
 3. Click ThisOutlookSession which will open the Code Editor paste the below code in the Editor -> Save it and Close the window.
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
   Dim strSubject As String
   strSubject = Item.Subject
   If Len(Trim(strSubject)) = 0 Then
       Prompt$ = "Subject is Empty. Are you sure you want to send the EMail?"
      If MsgBox(Prompt$, vbYesNo + vbQuestion + _
            vbMsgBoxSetForeground, _
            "Email Subject is Empty") = vbNo Then
        Cancel = True
      End If
  End If
End Sub
4. Now, restart the outlook. You will be prompted with a window where in Click on Enable Macros.
5. Now try sending an email without subject, you will be prompted for entering a Subject in the Email.