Monday, October 5, 2009
Wednesday, September 23, 2009
SharePoint workflow
However, the drawback is that you cant deploy it into multiple list / document library
This link will give u a better overview on how to leverage on sharepoint designer to create workflow.
Wednesday, September 16, 2009
how to enable debugging mode
You can turn on the debug mode by changing the below setting in web.config
1. CallStack="true"
2. customerrors mode="Off"
3. compilation debug="true" batch="false"
Tuesday, September 8, 2009
How to change theme when new site is created
One of the stupid way is to include the step to change the theme as part of the operating mannual, but let me show you the tricks.
If you understand the concept of branding on how to change the .master page, you will find this theme changer feature is very similar.
What you need to do is to :
1. Create a new theme (i.e. NewTheme) and put it in 12hive\ Themese folder
2. Create a new .vb file which inherit SPFeatureReceiver and override FeatureActivated method to include the below coding.
Dim objWeb As SPWeb
objWeb = properties.Feature.Parent
objWeb.ApplyTheme ( " NewTheme " )
objWeb.Update()
3. The above is to ensure that newtheme is being switched when the code is feature is activated.
4. Compile it with strong name and deploy to GAC.
5. Package this .dll as feature
6. Locate the onet.xml for site template that you have 12hive\template\sitetemplates\SITE NAME\xml
7. locate
The idea of this theme changer is very similar to branding.
Wednesday, July 15, 2009
SharePoint RSS
Follow this article to achieve it.
Tuesday, July 14, 2009
Survey on Publishing template for anonymous
How this happen is because a feature called ViewFormPagesLockDown is activated for publishing site.
So the key is to deactivate this.
stsadm -o deactivatefeature -name ViewFormPagesLockDown -url yrURL
find out more from here
Wednesday, July 8, 2009
Good Architect for DAL
After we retrieve data from database, typically we will have a datareader object. We can leverage on the method below to convert dr value to match with the data type in object class.
protected T GetDataObjectValue
{
int i = dr.GetOrdinal(columnName);
if (!dr.IsDBNull(i))
return (T)dr.GetValue(i);
else
return default(T);
}
Next, we can build a function to load the value into object class like below:
obj.ID = base.GetDataValue
If required, we can add the object into a object List.
Thursday, July 2, 2009
infopath limitation
- No native write to SQL databases. The ease of use of establing an ADO connection to SQL or Access, and being able to query and write back to a database is lost. Instead you will probably need to talk to the DB via a web service.
- No roundtripping for cascading picklists. Something I do all the time is have one picklist be a filter for another picklist. Common example, pick a state, which then filters the city field dropdown. Can't do that in a web form.
- Summary list of controls that aren't supported in web forms:
ComboBox,Multiple-Selection List Box
Master/Detail,Bulleted, Numbered and Plain List
Picture ,Ink Picture ,Vertical Label
Scrolling and Horizontal Region ,Horizontal Repeating Table
Choice Group ,Repeating Choice Group
Choice Section ,Repeating Recursive Section
ActiveX Controls
Refer to this article for more details, MSDN article.
With this limitation, this shows you how to perform debugging.
Wednesday, July 1, 2009
Email Regular expression validation
([\w\-\.]+)@((\[([0-9]{1,3}\.){3}[0-9]{1,3}\])(([\w\-]+\.)+)([a-zA-Z]{2,4}))
Tuesday, June 30, 2009
How to MASS remove item in list
private static StringBuilder BatchDeleteCommand(SPList spList)
{
StringBuilder sbDelete = new StringBuilder();
sbDelete.Append("< ? xml version=\ "1.0\" encoding=\"UTF-8\"?>
string command = "
"< / SetList>
foreach (SPListItem item in spList.Items)
{
sbDelete.Append(string.Format(command, item.ID.ToString()));
}
sbDelete.Append("
return sbDelete;
}
how to build web part
programming in infopath + print view
And it might be useful to talk about the print view. Very often after we submit the form, we need to print it. print view become handy when you have different form view for input and printout. Refer to this article for more details
More example
how to host infopath in asp.net web form
Monday, June 29, 2009
How to deal with infopath object
string xpath = "/my:myFields/my:field1";
XPathNavigator field1 = MainDataSource.CreateNavigator().SelectSingleNode(xpath, NamespaceManager);
string oldValue = field1.Value; // Read
field1.SetValue(“New Value”); // Write
Auto Generating file name for infopath post
To achieve this we can use timestamp as the fileName, but this will create another entry when you edit the form.
Refer to this on how to do it.
Wednesday, June 24, 2009
Infopath VS web form
One key advantage of infopath is the turnaround time, with it, System Integrator can build the infopath form from scratch and subsequently user can add new column / remove existing column from the form without any technical knowledge required.
The drawback is that Infopath license is required.
Wednesday, June 3, 2009
Content Deployment API
The answer is YES.
string centralAdminUrl = "http://office2007:15688";
SPSite adminSite = new SPSite(centralAdminUrl);
SPWeb adminWeb = adminSite.OpenWeb();
SPList pathList = adminWeb.Lists["Content Deployment Paths"]; ContentDeploymentPathCollection paths = new ContentDeploymentPathCollection(pathList.Items);
You can access various properties or method thru paths collection. It is as good as the list of path that you see in the content deployment page in central admin.
Refer here to find out more
Monday, June 1, 2009
Sharepoint Sales video
Friday, May 29, 2009
Form Based Authentication (FBA) in Sharepoint
The good news is, it is possible to leverage on the existing ASP.NET Membership provider in .net framework 2.0 onwards. The next question will be HOW TO do it ...
1. Create membership provider database by executing [aspnet_regsql.exe] from [C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727]
2. Give a name for the database, it is always better not to use the default name to avoid conflict of database, and continue the wizards to create the tables, stored procedures needed for membership providers
3. After you created the database, you need to add your first user. There are two ways:
a. Execute
declare @now datetimeset
@now= GETDATE()
exec aspnet_Membership_CreateUser '/', 'userlogin','password','','email@somewhere.com','','',1,@now,@now,0,0,null
b. Use VS to modify the ASP.NET Web configuration
4. Append three sections in web application web.config
<>
< name=" FBAConnectionString " connectionstring=" Data Source=.;Initial Catalog= MOSS_FBA;Integrated Security=True ">
< / connectionStrings >
< defaultprovider= " FBAMember ">
<>
< connectionstringname= " FBAConnectionString " enablepasswordretrieval=" false " enablepasswordreset=" true ">
requiresQuestionAndAnswer=" false "
applicationName="/"
requiresUniqueEmail="false"
passwordFormat=" Hashed "
maxInvalidPasswordAttempts="5"
minRequiredPasswordLength="1"
minRequiredNonalphanumericCharacters="0"
passwordAttemptWindow="10"
passwordStrengthRegularExpression=""
name="FBAMember" type="System.Web.Security.SqlMembershipProvider,System.Web,Version=2.0.0.0,Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a" /> < / providers >< / membership >
< mode=" Forms ">
< / authentication >
<> <> < key="FBAMember" value="%"> < / PeoplePickerWildcards >
5. Make the same changes in web.config for central admin
6. Central Admin --> Application Management --> Site Collection Owner, Add the user that you created in step 3
7. Central Admin --> Application Management --> Authentication Providers , you should see two entry. Click on the default zone.
8. Change the authentication to 'FORM' and update the Membership provider name:
9. You should be able to login now.
Wednesday, May 27, 2009
Sharepoint 2007 Boundaries (limitation)
It is always important to understand the limitation or boundary of the system. For example, you cant be creating item in the list without any limit.
Check it out from here
It provides you a better idea on how to plan your system
Sunday, May 24, 2009
Sharepoint content publishing
Then you may ask one question. HOW TO DO IT !!!
It is very simple, just follow the steps below:
On Target
1. Create a new web application in target.
2. Create a empty site, preferably using
stsadm -o createsite -url http://targetSiteUrl/ -ownerlogin yrLogin -owneremail yrEmail
--If you dont use blank site, you are expected to see error
3. Then you should go to central admin --> Operation --> Content Deployment Settings to turn on "Accept incoming content deployment jobs"
On Source
1. Go to central admin --> Operation --> Content Deployment Paths and jobs
2. Create new path
3. Create new job
4. Execute the job
One very important notes !!!
If you have feature deployed on the source, MAKE SURE YOU HAVE IT INSTALL IN TARGET AS WELL before the deployment started.
Some basic readings that you might want to start off before you perform publishing deployment
1. Basic Idea
2. Basic Walkthrough
3. Pre-deployment
4. Best Practice
Friday, May 22, 2009
Sharepoint Timer Error
You should check your [Windows Sharepoint Service Administration] if it is activated. !!! After you activated the service, make sure you run the command below to execute the timer job directly instead of wasting your time to wait for sharepoint to pick up the job.
STSADM –O execadmsvcjobs
The timer job for this operation has been created, but it will fail because the administrative service for this server is not enabled. If the timer job is scheduled to run at a later time, you can run the jobs all at once using stsadm.exe -o execadmsvcjobs. To avoid this problem in the future, enable the Windows SharePoint Services administrative service, or run your operation through the STSADM.exe command line utility
Wednesday, May 20, 2009
List Deleting event
One possible workaround that i found from sharepointking is to make use of itemDeleting events.
When list is deleted, itemDeleting event will be triggered. And the ListItem id will be 0.
Monday, May 18, 2009
How to activate a feature when site is created
The key word is feature stapler, which allows you to tight a feature that you need to activate to a site template.
In summary,
1. you create a new feature that set the scope to "farm" level
2. in the element.xml, you create
2B3451F0-BC93-41A4-9FAD-3A81861D651A : feature to be activated when site is created
STS#0 : STS is the template name, and 0 is the configuration ID in C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\1033\XML
Refer to http://sharepointmagazine.net/technical/development/introduction-to-sharepoint-feature-stapling-part-1
Saturday, May 16, 2009
How to change the bloodly PAGES when you create publishing page in page library
www.yoursite.com/site1/pages/myPage.aspx
www.yoursite.com/site1/pages/myPage2.aspx
Below article highlights on how to customize this behaviour. Instead of using the default createPage.aspx, we will change it to something else. And make modification from there.
Before you start, one point to take note, YOU MUST ADD THE FOLLOWING NAMESPACE IN THE NEW PAGE ELSE YOU WILL SPEND HOUR ON DEBUGGING
Import Namespace="Microsoft.SharePoint.Publishing"
<%@ Import Namespace="Microsoft.SharePoint.Publishing" %>
http://blogs.msdn.com/syedi/archive/2008/07/18/why-should-one-save-publishing-pages-in-pages-list-always-in-moss-bend-it.aspx
Tuesday, May 5, 2009
List Template Id's
100 Generic list
101 Document library
102 Survey
103 Links list
104 Announcements list
105 Contacts list
106 Events list
107 Tasks list
108 Discussion board
109 Picture library
110 Data sources
111 Site template gallery
112 User Information list
113 Web Part gallery
114 List template gallery
115 XML Form library
116 Master pages gallery
117 No-Code Workflows
118 Custom Workflow Process
119 Wiki Page library
120 Custom grid for a list
130 Data Connection library
140 Workflow History
150 Gantt Tasks list
200 Meeting Series list
201 Meeting Agenda list
202 Meeting Attendees list
204 Meeting Decisions list
207 Meeting Objectives list
210 Meeting text box
211 Meeting Things To Bring list
212 Meeting Workspace Pages list
301 Blog Posts list
302 Blog Comments list
303 Blog Categories list
1100 Issue tracking
1200 Administrator tasks list
Sunday, May 3, 2009
6 pillars of MOSS
1. Collaboration
2. Portal
3. Search
4. Content Management
5. Business Process
6. Business Intelligence
1. Collaboration
How does your organization share information ? In shared folder or riding on a custom built web page. With MOSS, you can have a better knowledge management by leverage on Wikis, Workspace, Forum and etc. These are out of the box feautes provided by MOSS.
2.Portal
Any enterprise should have a one corporate website to deliver information to the employee. Apart from the information delivering, MOSS can seamlessly integrate with various systems like SAP, oracle to make MOSS a one stop website for everything. For example, if you are using Oracle Siebel CRM to store your customer information, you dont have to login to Siebel system to see your customer list. You can view them from MOSS page.
3. Search
If you have tons of information and it is not accessable, these information will become useless. It is important to be able to search information with just a few clicks. And this feature is provided out of the box from MOSS.
4. Content Management
In this fast pace environment, how fast you response to the opportunity is the key differentiator for your competitors. With MOSS you can manage your website content as easy as a few clicks.
5. Business Process
Typical enterprise environment will need forms submission and workflow for approval. MOSS is built to integrate with various MSFT office products including Infopath, which allows you to fill in information and ready for submission. And form submission, workflow (both standard and customized build) can be activated to perform the tasks that is needed. For example, for leave application, employee can fill in the pre-designed form in infopath. After the form is submitted, approval workflow can be triggered for manager approval.
6. Business Intelligence
How do you capitalize your data is to gain a bigger market share is very important. With MOSS, you can integrate with SQL Reporting services easily (SSRS), you prepare report in various formats. On top of that you can also leverage on the datamining feature in SSRS.
Good Startup for MOSS
You will find very interesting MOSS related topic here, to avoid tons of words to start with, this is a very good material from MSFT for beginner.
2007 Office System: How Do I? (ScreenCasts)
Office 2007 Partner Technical Readiness Training Presentations
After seeing these videos, you should have a better understanding on MOSS
Wednesday, April 22, 2009
How to override existing behaviour in list,site....
1. Create basic event handler
http://msdn.microsoft.com/en-us/library/ms437502.aspx
2. custom Event Handler Deployment using Feature..
You need two files.
-Feature.xml
-Elements.xml
http://msdn.microsoft.com/en-us/library/ms475328.aspx
adding an entry to user field
ID ;# account name
In this case, you need the following code snippet to insert very into user field with the help of SPFieldUserValue
using (SPSite site = new SPSite("http://portal"))
{
using (SPWeb web = site.OpenWeb())
{
SPList list = web.Lists["Example For Users"];
SPListItem item = list.Items[0];
SPFieldUserValue userValue = new SPFieldUserValue(web, web.CurrentUser.ID, web.CurrentUser.LoginName);
item["User Name"] = userValue;
item.Update();
}
}
Get a user from a list item
using (SPSite site = new SPSite(http://mysite))
{
using (SPWeb web = site.OpenWeb())
{
SPList list = web.Lists["myList"];
SPListItem item = list.Items[0];
SPFieldUserValue userValue = new SPFieldUserValue(web, item["User Name"].ToString());
if (userValue.User.LoginName == web.CurrentUser.LoginName)
{
//current user found in the list
}
}
}