Showing posts with label SharePoint 2007. Show all posts
Showing posts with label SharePoint 2007. Show all posts

Friday, October 2, 2009

Some helpful STSADM command

Some helpful STSADM command

----Starting Service MSSQLServer...
NET START "SQL Server (MSSQLServer)"

----ECHO Resetting IIS...
"C:\WINDOWS\system32\iisreset.exe"

----Creating Roles and Membership database...
"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_regsql" -S <SQL Server Name> -E -d "<DB Name>" -A all

----Copying **** config file
CD C:\Vinod\folder1
COPY /Y ****.xml "C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\CONFIG"


----Installing and activating
STSADM -o activateFeature -filename *\feature.xml -url <Web app URL with Port> -force
----Deploy *.wsp solution package
--First adding solution package to farm...
STSADM -o addsolution -filename C:\folder1\*.wsp

--Deploying solution package to http://<MACHINENAME>:<CENTRALPORT> site... STSADM -o deploysolution -name *.wsp -url http://<MACHINENAME>:<CENTRALPORT> - allowgacdeployment -immediate -force

--STOP timers if any
STSADM -o execadmsvcjobs

--Error adding WSP Package; attempting upgrade instead
STSADM -o upgradesolution -filename C:\folder1\*.wsp -immediate -allowgacdeployment -allowcaspolicies

--STOP timers if any
stsadm -o execadmsvcjobs

----Adding Template
stsadm -o addtemplate -filename C:\folder1\TEMPLATE1.stp -Title "<TEMPLATENAME>"

----Create SSP
STSADM -o createssp -title "<SSP Title>" -url <SSP URL With PORT> -mysiteurl <MySite URL With PORT> -ssplogin <Domain Name>\<User ID> -ssppassword <Password> -indexserver <SQL Server name> -indexlocation "C:\Program Files\Microsoft Office Servers\12.0\Data\Office Server\SSPIndexes" -sspdatabasename <SSP DB Name> -searchdatabasename <SSP DB Name>

----Starting Office SharePoint Server Search...
STSADM -o osearch -action start -f -role IndexQuery -farmcontactemail <User Email ID> -farmserviceaccount <Domain Name>\<User ID> -farmservicepassword <Password> -defaultindexlocation "C:\Program Files\Microsoft Office Servers\12.0\Data\Office Server\OSSIndex"

----Extending "site" to internet zone
STSADM -o extendvsinwebfarm -url <New site with Port> -vsname "<Existing site>"

----Configuring Forms Authentication for webapp...
STSADM -o authentication -url <Web app URL with Port> -type forms -membershipprovider FBA_AspNetSqlMembershipProvider -rolemanager FBA_AspNetSqlRoleProvider

Create custom STSADM command

How to create custom STSADM command?
1. Create one class that inherited from ISPStsadmCommand class, And implements below method spcified in the Interface

public string GetHelpMessage(string command)
{
//Your help message.
}

public int Run(string command, StringDictionary keyValues, out string output)
{
//Your custom code using SP object model.
//Set out parameter as out on command prompt.
}

2. Above created dll need to have strong name key.
3. Register the above dll in GAC.
4. Make custom stsadmcommands..xml and put in @ C:\Program Files\Common Files\microsoft shared\Web Server Extensions\12\CONFIG.

This file contents the below command.

<Commands>
<command
name="createlist"
class="<ClassName>, <NameSpace>, Version=<No>, Culture=neutral, PublicKeyToken=<Key>"/>
</Commands>

5. Try to run command from command prompt.

Thursday, September 10, 2009

How to Create Job Sceduler in Sharepoint?

How to Create Job Sceduler in Sharepoint?
Create one custom StsadmCommand using ISPStsadmCommand class. And implement Run method, this method will create/Schedule the job. This STSADM calls once while installing product. This will create jobscheduler.(Here scheduler calls every 50 min)

Example:

//This custom STSADM call once while installing product
public class CustomSTSADM : ISPStsadmCommand
{
public int Run(string command, StringDictionary keyValues, out string output)
{
CustomJob.CreateMyJob(URL);
}
}
// SPJobDefinition class
public class CustomJob_Class : SPJobDefinition
{
//Need to override
[SharePointPermission(SecurityAction.LinkDemand, ObjectModel = true)]
public override void Execute(Guid ContentDataBaseID)
{
//TODO: Write what should be done by this job every defined time.
}


//Create JobSchedule for 50 min
Public CustomJob(string Url)
{
SPSite mySite = new SPSite(Url);
SPWebApplication application = mySite.WebApplication;
SPJobDefinitionCollection jobsColl =
application.JobDefinitions;

CustomJob_Class customJob = new CustomJob_Class("CustomJob ",
application);

customJob.Title = " Custom Job ";

SPMinuteSchedule mySchedule = new SPMinuteSchedule();
mySchedule.BeginSecond = 0;
mySchedule.EndSecond = 59;
mySchedule.Interval = 50;
customJob.Schedule = mySchedule;

jobsColl.Add(customJob);
application.Update();
}
}

Saturday, August 22, 2009

How to create for Forms Authentication for SharePoint?

Create Database:
First step is to create membership database to save users and their credentials. To create membership database follow steps given below:
1. Open “%windir%\Microsoft.Net\Framework\vx.x.xxxxx” folder. Run aspnet_regsql.exe.
2. And complete the wizard steps(Select Configure SQL Server for application services option from the wizard).
3. Once wizard completed membership database has been created.

Configure Membership Providers:

This will allow us to add the users and roles into the database. To create user and role in database follow steps given below:
1. Create a new web site.
2. Add connection string in web.config file shown below

<connectionStrings>
<remove name="XX_ConnectionString" />
<add name="XX_ConnectionString"
connectionString="Integrated Security=SSPI;
Data Source=<SQLServerName>;Initial Catalog=<DatabaseName>;"
providerName="System.Data.SqlClient" />
</connectionStrings>

3. Now next specify the membership and role providers in the web.config file under <system.web> tag like shown below

<membership defaultProvider="XX_AspNetSqlMembershipProvider">
<providers>
<add connectionStringName="XX_ConnectionString"
passwordAttemptWindow="20"
enablePasswordRetrieval="false"
enablePasswordReset="true"
requiresQuestionAndAnswer="false"
applicationName="/"
requiresUniqueEmail="false"
passwordFormat="Hashed"
maxInvalidPasswordAttempts="5"
minRequiredPasswordLength="1"
minRequiredNonalphanumericCharacters="0"
passwordStrengthRegularExpression=""
name="XX_AspNetSqlMembershipProvider"
type="System.Web.Security.SqlMembershipProvider,System.Web,
Version = 2.0.0.0 ,
Culture = neutral,PublicKeyToken=b03f5f7f11d50a3a" />
</providers>
</membership>

<roleManager enabled="true" defaultProvider="XX_AspNetSqlRoleProvider">
<providers>
<add connectionStringName="XX_ConnectionString"
applicationName="/"
name=”XX_AspNetSqlRoleProvider"
type="System.Web.Security.SqlRoleProvider, System.Web,
Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a" />
</providers>
</roleManager>

4. Then used ASP.Net Configuration Wizard to create Role and Users.

MOSS People Picker cannot search Domain users

Why MOSS People Picker cannot search Domain users?
If you installed SQL server and SharePoint using local user account and not domain account, then if you are going to search domain users from the people picker, then domain user will not found from people picker.

Some work around for this:
1. Change user account for all app pool and services of SQL server and SharePoint with domain user account.
All App pool accounts(for central admin and other SharePoint web application)

2. Give access to the SharePoint database to new domain account as owner.

3. Update central admin farm credentials with new domain user account for this just need to run stsadm command.
stsadm -o updatefarmcredentials -identitytype configurableid -userlogin -password
This will update farm credentials.

4. Update SSP credentials with domain user account, Used stsadm command for change the SSP account credentails.
Stsadm.exe -o editssp -title "SSP Name" -ssplogin -ssppassword

This will update all necessary credentials for SharePoint farm, Then will get domain user from the people picker.

Wednesday, May 27, 2009

How to deploy web service on SharePoint site?

1. Create .asmx file and mark it as strong name.
2. Put the DLL into GAC.
3. Put .asmx file into LAYOUTS folder
4. Open the .asmx in notepad, remove the CodeBehind attribute and modify the class attributes as below
Class=", , Version=, Culture=, PublicKeyToken="
5. Run disco command from command prompt and we will get .disco and .wsdl files
6. Copy all the 3 files (asmx, .disco and .wsdl) to ISAPI folder.
7. Rename the .disco and .wsdl files to .aspx files. e.g. Rename the EMBS.disco to EBMSdisco.aspx
8. Access the url as
:/_vti_bin/.asmx">http://:/_vti_bin/.asmx

Saturday, March 29, 2008

Timed Jobs within SharePoint

I was created Timed Jobs using SPJobDefinition class. And compiling and executing the program, the Job is for activated in the server.

But Timed Jobs not fired on time interval. To solve this problem need to do->
Stop and Start the "Windows SharePoint Services Timer" from the Windows Services Manager.