Tuesday, December 15, 2009

Something About Sharepoint

SharePoint is a web-based collaboration and document management platform from Microsoft. Microsoft Office SharePoint Designer (SPD) is a WYSIWYG HTML editor and web design program, which has replaced FrontPage, and is the ideal environment for working with pages on a SharePoint site.
Share point is all about enterprise data. When we talk about enterprise data it looks some as shown in the figure below. In other words grouping and sub groupings of data.





SharePoint = WSS 3.0 or MOSS 2007 (or both)
WSS = Windows SharePoint Services 3.0
MOSS = Microsoft SharePoint Server 2007
The previous version of SharePoint was WSS 2.0 + SPS 2003 (SharePoint Portal Server), but we will be talking about WSS 3 and MOSS 2007 here.
WSS is part of Windows Server, specifically Windows Server 2003 and Windows Server 2008. It is not automatically installed. You must first install IIS (Internet Information Server) and ASP.NET 2.0, plus .NET 3.0. These components are found either on your Windows Server media (CD/DVD) or through Windows Update. The important thing to understand is WSS is part of your Windows Server license.
MOSS is a separate product. MOSS requires either a MOSS Standard or MOSS Enterprise license. These both install from the same media, just require a different activation key. MOSS builds on top of WSS and adds additional components such as enhanced search, My Sites, Business Data Connector, Excel Services, and other features.
WSS and MOSS offer many of the same collaboration features:
• Site provisioning
• Document management (check in/check out)
• Discussions
• Wikis, Blogs, RSS Feeds
• Basic workflow
• Custom lists
MOSS builds upon WSS and adds:
• Additional workflows
• Web content management (web publishing features)
• Records management
• Auditing
• Additional search such as people search
• My Sites (each user has their own personal site with public and private areas)
• Enterprise features such as Excel Services and BDC

Advantages of using Site Collections

Share Point is all about data and data should properly authenticate / authorized to proper users. By defining the structure in site and site collection we can now define roles and responsibilities according to data. For instance in the above figure we will assign all HR user to payroll, recruitment and assessment site. These users will not be assigned to account site collection. Same holds true for accounts user.
So when you design your hierarchy of site and site collection you need to keep in mind the enterprise hierarchy structure and design the same accordingly.

Wednesday, July 8, 2009

Export Data from outlook Calander to Application through javascript

function ImportAppoinments()
{
try
{
if((window.ActiveXObject))
{ // create outlook object
var objOutlook = new ActiveXObject( "Outlook.Application" );
var olAppointmentItem = 1; //fixed for different properties of outlook object

var objAppointment = objOutlook.CreateItem(olAppointmentItem);
var outlookFolderCalendar = 9;
var objNameSpace = objOutlook.GetNamespace('MAPI');
var outlookFolder = objNameSpace.GetDefaultFolder(outlookFolderCalendar);
var myOutlookItems = outlookFolder.Items;
if(myOutlookItems.count>0)
{
for(var x=1;x<=myOutlookItems.count;x++)
{
var dateOfAppointment = myOutlookItems(x).Start;
var bodyOfAppointment = myOutlookItems(x).Body;
alert(dateOfAppointment+'\n'+bodyOfAppointment);
}

}
else
{
alert('No Events');
}
return false;
}
}
catch(e)
{
alert("If MS Outlook is already there\nplease try the following steps:\nClick on Tools (Menu)=>Internet options=>\n=>Security (Tab)=>Internet=>Custom level=>\nChoose 'Enable' from 'initialize and script Activex controls not marked as safe'");
return false;
}
}

Import data from application to Outlook Calender through Javascript

// JScript File
var formattedDate;
var olAppointmentItem = 1; //fixed for different properties of outlook object
//EXPORT to OUTLOOK
function ExportDataToOutlook()
{
var duration = 120; //number of minutes (duration in Outlook being in minutes)
SetTimeForAppointment();//time of appoinment was fixed
try
{
var objOutlook = new ActiveXObject( "Outlook.Application" );
}
catch(e)
{
alert("Outlook needs to be installed on the machine for data to export.");
return false;
}
var objAppointment = objOutlook.CreateItem(olAppointmentItem);
objAppointment.Subject = "Appointment exported to Outlook from a web application";
objAppointment.Body = "This is an appointment being exported into Outlook using a web-application.";
objAppointment.Start = formattedDate;
objAppointment.Duration = duration;
objAppointment.ReminderSet = false;
objAppointment.Save();
alert("An appointment was exported successfully to your Outlook calendar in todays date.");
return true;
}
function SetTimeForAppointment()
{
var currentDate = new Date();
var month = currentDate.getMonth();
var day = currentDate.getDate();
var year = currentDate.getFullYear();
formattedDate = (month+1) + "/" + day + "/" + year + " 08:00AM";
}

Tuesday, June 2, 2009

Imports Data From OutLook in Javascript and save in db in post method

function ImportFromOutLook()
{
try
{
if((window.ActiveXObject))
{
var Const_olFolderContacts = 10;
var objApp = new ActiveXObject('Outlook.Application');
var objNS = objApp.GetNamespace('MAPI');
var colContacts = objNS.GetDefaultFolder(Const_olFolderContacts).Items
if(colContacts.count==0)
alert('No Contacts in your Outlook');
for( var i=1; i<=colContacts.count;i++)
{
var v = colContacts.item(i);
var xmlHttp= new ActiveXObject("Microsoft.XMLHTTP");
xmlHttp.open("POST", "../Popup/Ajax.aspx", true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Connection", "close");
var data="FullName="+encodeURIComponent(v["FullName"])+
"&HomeAddressStreet="+encodeURIComponent(v["HomeAddressStreet"])+
"&HomeAddressCity="+encodeURIComponent(v["HomeAddressCity"])+
"&HomeAddressPostalCode="+encodeURIComponent(v["HomeAddressPostalCode"])+
"&HomeAddressState="+encodeURIComponent(v["HomeAddressState"])+
"&HomeAddressCountry="+encodeURIComponent(v["HomeAddressCountry"])+
"&HomeTelephoneNumber="+encodeURIComponent(v["HomeTelephoneNumber"])+
"&HomeFaxNumber="+encodeURIComponent(v["HomeFaxNumber"])+
"&Email1Address="+encodeURIComponent(v["Email1Address"])+
"&BusinessAddressStreet="+encodeURIComponent(v["BusinessAddressStreet"])+
"&BusinessAddressCity="+encodeURIComponent(v["BusinessAddressCity"])+
"&BusinessAddressPostalCode="+encodeURIComponent(v["BusinessAddressPostalCode"])+
"&BusinessAddressState="+encodeURIComponent(v["BusinessAddressState"])+
"&BusinessAddressCountry="+encodeURIComponent(v["BusinessAddressCountry"])+
"&BusinessTelephoneNumber="+encodeURIComponent(v["BusinessTelephoneNumber"])+
"&BusinessFaxNumber="+encodeURIComponent(v["BusinessFaxNumber"])+
"&MobileTelephoneNumber="+encodeURIComponent(v["MobileTelephoneNumber"])+
"&Email2Address="+encodeURIComponent(v["Email2Address"])+
"&Module=OutLook";
xmlHttp.send(data);
}
if(colContacts.count>0)
alert('Outlook Address imported Successfully');
}
else
{
alert("Your browser does not support to import from outlook \n please use 'internet explorer' browser.");
}
return false;
}
catch(e)
{
alert("If MS Outlook is already there\nplease try the following steps:\nClick on Tools (Menu)=>Internet options=>\n=>Security (Tab)=>Internet=>Custom level=>\nChoose 'Enable' from 'initialize and script Activex controls not marked as safe'");
return false;
}
}

Friday, April 3, 2009

How to Find the 1st Day of week and Last Date of a month

SELECT DATEADD(WK, DATEDIFF(WK, 0, getdate() - 2), 0)
select DAY(DATEADD (m, 1, DATEADD (d, 1 - DAY(getdate()), getdate())) - 1)

Thursday, April 2, 2009

Fetch XML format Data in SQL server

Hi ,
let's to discus how we ll read XML data in sqlserver .

DECLARE @docHandle int, @OID int,@order nvarchar(4000)
set @order='
<?xml version="1.0"? >
<Order >
<CustomerID > ALFKI </CustomerID >
<EmployeeID > 3 </EmployeeID >
<OrderDate>07/3/2004 < OrderDate >
<RequiredDate>07/4/2004 </RequiredDate >
<ShippedDate>15/3/2004 < /ShippedDate >
<OrderDetails ProductID="2" UnitPrice="15"
Quantity="5" Discount="0.15" > < /OrderDetails>
<OrderDetails ProductID="4" UnitPrice="22"
Quantity="7" Discount="0.21" > </OrderDetails >
<OrderDetails ProductID="10" UnitPrice="31"
Quantity="3" Discount="0.15" > </OrderDetails >
</Order>'


EXEC sp_xml_preparedocument @docHandle OUTPUT, @order
SELECT CustomerID, EmployeeID, OrderDate, RequiredDate
FROM Openxml( @docHandle, '/Order', 3)
WITH ( CustomerID nchar(5),
EmployeeID int, OrderDate datetime, RequiredDate datetime )
SELECT @OID AS [PO ID], ProductID, UnitPrice, Quantity, Discount
FROM OpenXml( @docHandle, '/Order/OrderDetails', 1) WITH
( ProductID int, UnitPrice money, Quantity smallint, Discount real )

*************************************************************
Procedure
*************************************************************
CREATE PROCEDURE xmlOrderInsert @order ntext
AS
DECLARE @docHandle int, @OID int
EXEC sp_xml_preparedocument @docHandle OUTPUT, @order
BEGIN TRANSACTION
INSERT INTO Orders( CustomerID, EmployeeID, OrderDate, RequiredDate )
SELECT CustomerID, EmployeeID, OrderDate, RequiredDate
FROM Openxml( @docHandle, '/Order', 3)
WITH ( CustomerID nchar(5),
EmployeeID int, OrderDate datetime, RequiredDate datetime )
IF @@ERROR<>0 BEGIN ROLLBACK TRANSACTION RETURN -100 END
SET @OID = SCOPE_IDENTITY()
INSERT INTO [Order Details] ( OrderID, ProductID, UnitPrice, Quantity, Discount )
SELECT @OID AS [PO ID], ProductID, UnitPrice, Quantity, Discount
FROM OpenXml( @docHandle, '/Order/OrderDetails', 1) WITH
( ProductID int, UnitPrice money, Quantity smallint, Discount real )
IF @@ERROR<>0 BEGIN ROLLBACK TRANSACTION RETURN -101 END
COMMIT TRANSACTION
EXEC sp_xml_removedocument @docHandle SELECT @OID AS [Order ID]
GO

Thursday, February 5, 2009

Customize Table from string Data in Sqlserver

Hi,
Now let's to discus how we can create a customize Table in Sqlserver.
while my work i face a problem of filterization of employee code.I have to filter some record based on the employee code.
I was passing multiple employeecode to the procedure which datatype is bigint.
so passed the employeecode as a varchar to the procedure by separating ',' .
so let's see how i solve this problem.
for example :
EmployeeCodes : 1,2,3,4

create Procedure USP_Filter_Employees
@EmpCode Varchar(100)
As
DECLARE @idoc int
set @
EmpCode ='< col > < r > '+@EmpCode
select @EmpCode =replace (@EmpCode ,',' ,'</r ><r >' )+'<r></col>'

EXEC sp_xml_preparedocument @idoc OUTPUT, @EmpCode
select * from EmployeeDetails where EmployeeCode in
(
SELECT cast(cast (text as varchar) as bigint)FROM OPENXML (@idoc, '/col/r',3) where text is not null
)
End