Saturday, January 10, 2015

Using SharePoint web services with SSL ; Adding SSL Certificate to SharePoint Site ; Error : The remote certificate is invalid according to the validation procedure.

Task : Uploading file using SharePoint web services ( Authentication.asmx , Copy.asmx , Lists.asmx ).
Conditions :

  1. Using webserivces from http://www.xyz.com to https://www.abc.com .
  2. Using Webpart ( c# Code )
  3. Caller and Consumer both are SharePoint portals.
Errors:
The remote certificate is invalid according to the validation procedure.
An operation failed because the following certificate has validation errors:\n\nSubject Name: CN=*.abc.xyz.ae
Solution :

Step 1 # open https portal and download (Export) ssl certificate.
Step 2 # Go to sharepoint central admin > Secuirty > Manage Trust
  • Add new certificate
Step 3 # Reset IIS on All web front ends.

Help Links :

http://blogs.msdn.com/b/jpsanders/archive/2009/09/16/troubleshooting-asp-net-the-remote-certificate-is-invalid-according-to-the-validation-procedure.aspx

Sunday, January 4, 2015

How to Remove SharePoint extended web application;How to change SharePoint web-application Host Header

I came across the issue where I have to change Host Header of Extended web application in SharePoint 2010 , I found that you can not change host header of extended web application  to new one ,To achieve this we have to remove that extended zone web application from central administration 

1.  Go to Central Administrator, Application Management, Select the Web Application you wish to change and hit the arrow under Delete and choose  Remove SharePoint from IIS Site.

clip_image002

2. Next, select the associated site you which to update the host header URL against.    For Delete IIS web sites, select No and hit OK.
image

After these steps ,extended web application will no longer be associated with your web application and you can extend it again with new Host Header and details for the same zone , I hope it helps.

I found above solution @ http://blogs.msdn.com/b/russmax/archive/2013/02/27/how-to-properly-change-the-host-header-url-of-a-web-application-in-sharepoint-2010.aspx , Thanks to  "Russ Maxwell"

Thanks,
Rahim
RahimKhowaja@hotmail.com

Saturday, January 3, 2015

Is that possible to have two Web-application on Port 80 ? Yes ; Two web application on Port 80 with Different Host headers

Issue : I have to use same port for two web application , Simply by changing host header name we can achieve this.

http://www.hotmail.com
http://www.yahoo.com

Both web applications can survive on same port

Thanks,
Rahim

How to convert base64 to bitmap image ; how to show image from base64 to Rdlc report ; Show QRCode in PDF ;

Problem :

We codded for QRCode with the help of JQuery but it was difficult to show that QR Code on Report Viewer and genrate PDF . Following code will change the QRCode to stream and save it in local place and then placed it in report viewer ; Sorry for dirty code but It might help you out .

 ReportViewer1.LocalReport.Refresh();
        string imageDataParsed = Image1.Value.Substring(Image1.Value.IndexOf(',') + 1);
        byte[] imageBytes = Convert.FromBase64String(imageDataParsed);
        using (var imageStream = new MemoryStream(imageBytes, false))
        {
            Bitmap image = new Bitmap(imageStream);
            image.Save(Server.MapPath("test.jpg"));
        }

        ReportViewer1.LocalReport.ReportPath = Server.MapPath("Report.rdlc");
        ReportViewer1.LocalReport.EnableExternalImages = true;
        string imagePath = new Uri(Server.MapPath("test.jpg")).AbsoluteUri;
        Microsoft.Reporting.WebForms.ReportParameter rptZoneName = new Microsoft.Reporting.WebForms.ReportParameter();
        rptZoneName.Name = "ReportParameter1";
        rptZoneName.Values.Add(imagePath);
        // rptZoneName.Values.Add(imagePath);
        ReportViewer1.LocalReport.SetParameters(rptZoneName);

Thanks,
Rahim 

How to deploy Solution in SharePoint with Power Shell ; Solved Error : Feature is already installed in this farm use the -force attribute;

I Come across the error while deploying wsp package on SharePoint 2010 , I was trying to do it with command "Add-SPSolution -LiteralPath " but once it shows the solution in central administration and I tried to deploy , it throws an error that feature no ##### is already installed please use some -force attribute to install it , It was resolved once I used following command 

Install-SPSolution -Identity "XXXXXXX.wsp" -WebApplication "http://abcd.com" -GACDeployment -Force

Thanks,
Rahim

Wednesday, October 13, 2010

Difference Between Site Collection , Sites and SubSites

One of the most frequently asked question about sharepoint is “What is site Collection ? What is Site and What is Sub Site ?“ , so here I have tried to explain it .


Site Collection, Sites And Sub Sites All are same , How ? Think of a Big Box,If you put Small Box in an big Box then first you have to open Big Box and then you have to put a small box in it , similarly if you have another smaller box you can put it in the smaller one now your big Box have a Small Box And Small box have an Smaller Box , you can have as many boxes as you want , but why I am explaining it here Think of Site Collection as a Big Box and Site as Small Box and Sub Site as More Smaller Box , So far all are boxes and have same properties but all Are Dependent in a way that if you are not opening Big Box you cannot get Small Box , Now SharePoint Also works likes this , But why SharePoint have done this ? because to manage things in hierarchies are simple for example "Permissions", If I Lock the big Box no one is going to see Other boxes but if I lock the Second Box no one will be able to See the third one inside it , Logically All of these are same but Site Collection have more Advance features because it is the First Box .

The SharePoint Way :

In SharePoint

1st level is : Site Collection

2nd Level is: Sites

3rd Level is: Sub Sites .



Example : Think of a Bank which have many departments some are related and other are not realted to each other , IT is not related to any other department in sense of Transactions It makes softwares and give support , HR and IT are not linked with Each other as they have different roles . So if I say Create a SharePoint Site One must Create one Site Collection and Called it Bank [ Home] and create two Sub Sites and call them HR and IT .Great I have also done it first .

Now one day HR site is full of documents and IT site is fine they don’t have many documents on their site, Due to HR site IT Guys are also waiting for a long time, Now you have decided to separate them HR on one server and IT on Other server ( If you are not getting me here don’t worry it is only be understood by the one who deploy SharePoint on Farm ),Now you cannot separate them because SharePoint only gives you backup and restore facility at First Level that is Site Collection , It means you cannot separate IT and HR now ,You must have to do some homework for these things in start and identify which are dependent and which are not ? organizations will pay you for this ;)

It means we have done something wrong and now nothing can be done , So think in a broader way when you are creating site collections and sites, If we have created two site collections HR and IT we can shift them from one server to other it is only one benefit or Plus point goes to Site Collection,there are others ... But if you have got a task to create a Team Site for a group of HR people then you will definitely create it Under “HR” site collection you will not create it as another Site Collection ..

I Hope this will help ...
ask @ rahimkhowaja@hotmail.com

Tuesday, October 12, 2010

What is Difference Between Wss And Moss ? Why Wss Or Why Moss ?

As a beginner of SharePoint when I start looking at books and blogs I was very confused about what really is the difference so I have started going in more depth but the real difference I found when I started installing both of them, So let’s go through my experience and you will come to know what is the difference. I hope so ;)
First rule of learning , Forget everything you have in mind before , think like you are new to SharePoint and have never seen or heard about sharepoint,Here we go now ..
When we install windows 2003 server Microsoft is offering you many free software’s like notepade,sound recorder etc but Microsoft gives you one thing more which is a Website which can be used within an organization for sharing documents or messaging each other and many other collaborative things , so what is that free thing called ? That free thing is SharePoint portal, Microsoft is giving it for free but why organizations of world are buying Microsoft Office SharePoint Server in $45000 for their organization if it is free with windows server 2003,The reason is of features , What Microsoft gives for free have few features in it but if you want all features you have to buy it from Microsoft ,I think it is very simple …
Note : Add and remove program of windows server have Microsoft SharePoint Portal Free one , If it is not there Download it from Microsoft Site for Free

Now Wss And Moss :-

Well think of 3 tier application in which there is a presentation layer , business logic layer and Data layer , Presentation layer have Web Forms ( ASPX ) logic behind these forms Call functions in Business Logic Layer , Now if you create a business logic Layer and expose methods and function and classes so you are basically giving opportunity to Others to use that business logic Layer ( DLL ) , Microsoft have done the same thing They created a Complete Web Portal ( SharePoint ) on Asp.net and given opportunity to developers to do whatever they want by using their DLL ( Windows SharePoint Services ) , you can have it with the free version but API is limited but when you buy Microsoft Office SharePoint Server (MOSS) you get many other things in that portal , It is same like we buy a trial version with limited functionality and buy full Version by giving Extra amount .
Now many organizations are happy with WSS and I am sure that Free version is also very much usefull and can be used by organizations for Intranet Portals ( Portals runs inside organization ) and if organization need more features then they have to buy Complete version . Even if you want to make that Intranet Portal ( Inside Organization) to run on Internet ( Outside Organization ) You have to pay money 

Difference in Development:-

It is very obvious that if you are developing web parts and other controls on free version you will not get benefit of other functions and methods given by Microsoft in full version ,but you can develop any thing using that basic DLL ( WSS )

ask @ rahimkhowaja@hotmail.com

Tuesday, August 31, 2010

Free Guide [Installing and Configuring SharePoint 2010] PDF Version

It's limited time offer, Free download Now, PDF version:
Free Download: http://tinyurl.com/Install-Config-SharePoint-2010

Saturday, August 28, 2010

Creating User Control For Sharepoint 2007 With Ajax

Please have a look on smart part, This is the best control to be used and easily deployed.

http://smartpart.codeplex.com/

To enable Ajax in Sharepoint .

Steps:
1 # download ajax tool kit and library from microsoft site and install it.
2 # change entries in web.config which is the most difficult part as there are many of them.
3 # you can use Ajax in User Controls you develop in visual studio , but the problem here is if you downloading ajax tool kit 1.1 and creating control in ajax tool kit in greater version then it will not work , try to work with same tool kit you have installed on sharepoint server.


Steps

1 : Install smart part feature from above link.
2 : Create Custom User Control ( ASCX ) in Visual Studio.
3 : Use those controls

Note : if you dont want ajax then simply install smart part and create usercontrols and deploy them

Enjoy !

for details email me @ rahimkhowaja@hotmail.com

Wednesday, August 25, 2010

How to hide "New" button from from MOSS 2007 List ??

Following are some of the things you can do to resolve this ..

1# Use Javascript to hide the New button. ex.
var oNewButton = docuement.getElementById('zz14_New0');

2# This can also be done Out of the Box: just allow the management of Content Types, delete the List Content Type 'Document' and hide the New Folder button via the Advanced Settings.

3# Just give "Read" permissions to the users you don't want to see new button , your problem is solved , But when you give read permissions, the users also can't upload documents anymore.

4# set the Toolbar Type to "Summary Toolbar", only upload is allowed by doing this.

Saturday, January 3, 2009

CAML(Collaborative Application Markup Language)

CAML is just like XML but it is Used as SQL Query for Sharepoint Lists ( list is like a grid view of asp.net but with much more rich functionality in which sharepoint stores its data ).With CAML one can perform SQL Quries to fetch out data from Sharepoint Lists.

Syntax:

<Query><Where><!--Comparison Operators here--><Eq><FieldRef Name=”insertFieldNameHere” /><Value Type=”insertDataTypeHere”>insertValueHere</Value></Eq></Where><OrderBy><FieldRef Name=”insertFieldNameHere” /><FieldRef Name=”insertFieldNameHere” /></OrderBy></Query>

Example :

Simple Sql Query

Select EmployeeName from Employes Where Salary < 3000

CAML :

<Query><OrderBy><FieldRef Name=”EmployeeName” /></OrderBy><Where><Lt><FieldRef Name=”Salary” /><Value Type=”INT”>3000</Value></Lt></Where></Query>

Here in above example we are not using any Table name because we will apply this query on List of Sharepoint like :

It is console programe for C#.net , but you must have WSS 3.0 installed.

class Program
{
static void Main(string[] args)
{
string siteUrl = args[0];
string listName = args[1];
string viewName = args[2];
SPSite site = new SPSite(siteUrl);
SPWeb web = site.OpenWeb();
SPList employeesList = web.Lists[listName];
SPQuery query = new SPQuery(employeesList.Views[viewName]);
System.Diagnostics.Debug.WriteLine(query.ViewXml);
Console.WriteLine(query.ViewXml);
Console.ReadLine();
}
}

Thursday, January 1, 2009

How to Work on web part with out Sql Server Express

To work with web parts if you dont have sql server express or you want to point your webparts settings to some other database then configure your web.config file.

Step1# Define Connection String that points to your database.
Step2# Define ConnectionStringName property of Defualt provider to your Connection String defined in step#1
step#3 If web parts are not working or throwing exception of Schema then use aspnet_regsql.exe to create schema(Tables and stored Procedures) by Asp.net so that data used for webparts is retrived and saved again in your define database.

Enjoy ;)

web.config --- Code
<appSettings/> <connectionStrings> <add name="LocalSqlServer1" connectionString="Data Source=server;Initial Catalog=database_rahim;User ID=rahim;Password=test/> </connectionStrings> <system.web> <webParts> <personalization defaultProvider="SqlPeronalizationProvider"> <providers> <add name="SqlPeronalizationProvider" type="System.Web.UI.WebControls.WebParts.SqlPersonalizationProvider" connectionStringName="LocalSqlServer1" /> </providers> </personalization> </webParts>

Friday, December 26, 2008

Introduction to WebParts

Suppose that we want to create a page that allows users to easily add informationabout topics that interest them. If you’ve ever used SharePoint or other modernInternet portal applications such as http://www.live.com and http://Google.com/ig,you’ve seen that applications already exist that allow these types of additions by users.The different informational components that are added to the pages, such as newsupdates or Dilbert comics, are known as web parts.