Wednesday, December 24, 2008

Custom WorkFlow deployement in Visual Studio 2008

If you’re using Visual Studio 2008 the workflow will have been automatically deployed to the site collection you specified as the development site when you first created the workflow project. However should you need to deploy the workflow to a different server or site collection then these are the steps that you’ll need.

The following steps will deploy your workflow to a site collection.

1. Copy the DLL your workflow creates from the build directory (\bin\Debug) to the Global Assembly Cache (GAC)

2. Create a directory in the features directory [C:\Program Files\Common Files\microsoft shared\Web Server Extensions\12\TEMPLATE\FEATURES] and drop both the feature.xml and workflow.xml files into the directory.

3. Install the feature on your farm, using the following command line statements

stsadm -o installfeature -name DocumentMoveAndShortcut

Figure 18 - Install the feature

4. Activate the feature to a site collection

stsadm -o activatefeature –name DocumentMoveAndShortcut -url http://moss2007win2008

Figure 19 - Activate the feature

NOTE: You can usually find the STSADM command in the directory C:\Program Files\Common Files\microsoft shared\Web Server Extensions\12\BIN

Sunday, December 14, 2008

Sharepoint Workflow

seful information about sharepoint workflows

http://www.cmswire.com/cms/web-cms/web-content-management-with-sharepoint-moss-2007-part-2-workflow-002021.php


http://www.u2u.info/Blogs/Kevin/Lists/Posts/Post.aspx?ID=39

SharePoint 2007 Workflow with Visual Studio 2005
http://weblog.vb-tech.com/nick/archive/2006/09/04/1753.aspx

Visual Studio 2005 extensions for .NET Framework 3.0 (Windows Workflow Foundation)
http://www.microsoft.com/downloads/thankyou.aspx?familyId=5d61409e-1fa3-48cf-8023-e8f38e709ba6&displayLang=en

How to: Deploy a Workflow Template
http://msdn.microsoft.com/en-us/library/ms460303.aspx

Wrangling SharePoint Workflows with Visual Studio http://www.devx.com/webdev/Article/34032/1954

Developing Sequential Workflows for SharePoint Server 2007 Using Visual Studio 2008http://msdn.microsoft.com/en-us/library/cc811589.aspx

Beginners Guide to SharePoint 2007 Workflow Development - Create an InfoPath Web-Based Form
http://www.sharepointbuzz.com/2008/11/07/beginners-guide-to-sharepoint-2007-workflow-development-create-an-infopath-web-based-form/

SharePoint 2007 Workflow with Visual Studio 2005 + InfoPath 2007 (RTM VERSION!)
http://weblog.vb-tech.com/nick/archive/2007/02/25/2207.aspx

Thursday, December 11, 2008

Show/Hide View All Site Content link in Sharepoint based on permissions

If you want to show/hide the View All Site Content link in SharePoint based on the user permissions.

connect your site to Sharepoint Designer (Daniel may be right about WSS 3.0), then navigate to _Catalogs >> masterpage >> default.master

Next find the PlaceHolderLeftNavBar content place holder and you can use the Sharepoint:SPSecurityTrimmedControl to hide a link (See example below on how to hide the "View All Site Content Link")

<asp:contentplaceholder id="PlaceHolderLeftNavBar" runat="server">
<div class="ms-quicklaunchouter">
<div class="ms-quickLaunch">
<Sharepoint:SPSecurityTrimmedControl runat="server" PermissionsString="ManageLists, ManageSubwebs">
<div class="ms-quicklaunchheader">
<SharePoint:SPLinkButton id="idNavLinkViewAll" runat="server" NavigateUrl="~site/_layouts/viewlsts.aspx" Text="<%$Resources:wss,quiklnch_allcontent%>" />
</div>
</SharePoint:SPSecurityTrimmedControl>
.......


You will see the PermissionString = ManageLists, ManageSubwebs which will hide this link to everyone except the Site Owner.

The PermissionsString attribute defines the permissions the user must have in order to view the content. See SPBasePermissions enumeration for a listing of possible values.


http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spbasepermissions.aspx

DHTML ToolTips

The below site is a good site for creating DHTML tooltips for cross browsers.

Download the javascript files from the site, and add them to your site, and customize your tooltips.

Enjoy!!

http://www.walterzorn.com/tooltip/tooltip_e.htm

Tuesday, December 02, 2008

Thursday, November 27, 2008

Publish Source code in Blogger

In the blogger,Click on Layout tab ->Edit HTML and put following things Before </head>

<link href='http://syntaxhighlighter.googlecode.com/svn/trunk/Styles/SyntaxHighlighter.css' rel='stylesheet' type='text/css'/>
<script language='javascript' src='http://syntaxhighlighter.googlecode.com/svn/trunk/Scripts/shCore.js'/>
<script language='javascript' src='http://syntaxhighlighter.googlecode.com/svn/trunk/Scripts/shBrushCpp.js'/>


2. put following things Before </body>

<script language="javascript">
dp.SyntaxHighlighter.BloggerMode();
dp.SyntaxHighlighter.HighlightAll('code');
</script>


3. Convert your code using any WYSISYG editor (Paste in editor and copy html view of editor)

OR

Copy your code in notepad and replace all < in &lt; etc.

4. Put your updated code between:
<pre name="code" class="Cpp">
….My code here…
</pre>

SharePoint workflow development links from various sites.

Introductory material - things you should know before opening Visual Studio :

SharePoint Workflow - Workflow Basics (Training course)

SharePoint Workflows - How to collect feedback for a file (Training Course)

Introduction to workflows - Windows SharePoint Services (Introductory article)

Intermediate and advanced resources

MSDN - Delivering Modular SharePoint workflow functionality (Part 1 of 2)

MSDN - Delivering Modular SharePoint workflow functionality (Part 2 of 2)

SharePoint Workflow Resource Center - here you will find technical articles, developer documentation, multimedia presentations, blog entries, and download content to support the Workflow functionality in Office SharePoint Server 2007.

Developer introduction to Workflows for Windows SharePoint Services 3.0 and SharePoint Server 2007
MSDN Magazine - Build workflows to capture data and create documents

Developing workflow solutions with SharePoint Server 2007 and Windows Workflow Foundation

MSDN - Visual How to - Guide to SharePoint sequential workflows with Visual Studio 2008

MSDN - Visual How to - Building an Expense Report Approval Workflow for SharePoint Server 2007 using Visual Studio 2008


MSDN - Visual How to - Building simple custom approval workflows with InfoPath 2007

MSDN - Visual How to - Building state machine document approval for SharePoint Server 2007 using Visual Studio 2008

Get the selected text using Javascript

Sometimes you want to know what text the user has selected with their mouse. The below function is used to get the selected text into text area. Place the follwoing code in the head section of html

function getSelText()
{
var txt = '';
if (window.getSelection)
{
txt = window.getSelection();
}
else if (document.getSelection)
{
txt = document.getSelection();
}
else if (document.selection)
{
txt = document.selection.createRange().text;
}
else
return;
document.aform.selectedtext.value = txt;
}


call this function in the button click event or where ever you want.

<input type="button" value="Get selection" onmousedown="getSelText()"><form name=aform ><textarea name="selectedtext" rows="5" cols="20"></textarea>



Tuesday, November 25, 2008

Automation in Visual Studio 2005 for WSS v3 Feature Development

It is possible to create useful and time-saving tools for automation inside the Visual Studio 2005 IDE. In my development environment I've defined and frequently use tools to add, deploy, upgrade, retract, and delete a WSS Solution Package (wsp). My favorite of these tools is the upgrade operation, as it allows for a quick "build and test" iterative development cycle. Behind the scenes, each of these tools call the appropriate stsadm.exe operation and display the command's result in Visual Studio 2005's Output Window.

Add Solution command to tools menu of Visual Studio 2005:

Command: C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN\STSADM.EXE

Arguments: -o addsolution -filename "$(ProjectDir)Package\$(TargetName).wsp"

WSP Solution Deploy Global

Command: C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN\STSADM.EXE
Arguments: -o deploysolution -local -allowgacdeployment -allcontenturls -name $(TargetName).wsp

WSP Solution Upgrade

Command: C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN\STSADM.EXE
Arguments: -o upgradesolution -local -allowgacdeployment -name $(TargetName).wsp -filename "$(ProjectDir)Package\$(TargetName).wsp"

WSP Solution Retract
Command: C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN\STSADM.EXE
Arguments: -o retractsolution -local -allcontenturls -name $(TargetName).wsp


WSP Solution Delete
Command: C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN\STSADM.EXE
Arguments: -o deletesolution -name $(TargetName).wsp

Monday, November 24, 2008

Display full image on mouse click and mouse use using javascript and filters

function doImageShow(vImg)
{
if (navigator.product != "Gecko")
document.getElementById('imgCon').filters.item(0).Apply();

document.getElementById('imgShow').setAttribute('src',vImg.src);
document.getElementById('imgShow').setAttribute('alt', 'Click the image to close.');
document.getElementById('imgCon').style.display = "";
var newImg = document.getElementById('imgShow');
if (self.innerWidth)
{
frameWidth = self.innerWidth;
frameHeight = self.innerHeight;
}
else if (document.documentElement &&document.documentElement.clientWidth)
{
frameWidth = document.documentElement.clientWidth;
frameHeight = document.documentElement.clientHeight;
}
else if (document.body)
{
frameWidth = document.body.clientWidth;
frameHeight = document.body.clientHeight;
}
else
{
frameWidth = screen.availWidth;
frameHeight = screen.availHeight;
}
iWidth = newImg.width;
iHeight = newImg.height;
if(iWidth == 0) iWidth = 500;
if(iHeight == 0) iHeight = 500;
imgPosLeft = frameWidth/2 - iWidth/2 + document.body.scrollLeft;
imgPosTop = frameHeight/2 - iHeight/2 + document.body.scrollTop;
document.getElementById('imgCon').style.position = "absolute";
document.getElementById('imgCon').style.left = imgPosLeft;
document.getElementById('imgCon').style.top = imgPosTop;
if (navigator.product != "Gecko")
document.getElementById('imgCon').filters.item(0).Play();
}
function doImageClear()
{//clear the image
document.getElementById('imgShow').removeAttribute('src');
document.getElementById('imgCon').style.display = "none";
}

place the above script in head section of html

Now place one div with syle as none, and one image with fixed width and height.
when you click on the image, the showPic function will call, which will resize your image to big one.


<div id="imgCon" style="display: none; z-index: 100;filter:progid:DXImageTransform.Microsoft.Fade(duration=0.7);
left: 10px; overflow: auto; position: absolute; top: 10px">
<div class="closeLnk" onclick="doImageClear();">
close</div>
<div id="picLibImgHolder">
<img class="imageStyle" class="galleryImg" id="imgShow" style="cursor: pointer" onclick="doImageClear();"
border="0" name="imgShowN"></div>
</div>

<img class="imageStyle" src="/PublishingImages/CFMR.jpg" width='100' height='80' id="imgCF" onclick="javascript:return showPic(this);" />

Expanding image on mouseover

This code project artical is just a javascript, that will help you to animate your image or any display article, like a div from some specified size to another size. Thus enable you to make a dynamic web page were the pictures glows from thumbnail view to a full image.

http://www.codeproject.com/KB/scripting/Expanding_Image_Animator.aspx

Using BeforeProperties and AferProperties of ListItem Event Handler

Accessing Property of a list item directly

Public override void ItemAdded(SPItemEventProperties property)
{
string titlePro=properties.AfterProperties["Title"].toString();
int idProperty=conver.toInt32(properties.AfterProperties["Title"].toString());
}

Looping through property collection

Public override void ItemAdded(SPItemEventProperties property)
{
SPItemEventDataCollection propertyCollection=properties.AfterProperties;
foreach(DictionaryEntry entry in propertyCollection)
{
string filedName=entry.key.toString();
string fieldValue=entry.Value.toString();
}
}

Sharepoint SPField InternalName vs DisplayName

Following is the list of common spfieldcollection/spfield methods
and name they require (Display Name / Internal Name).

  • SPFieldCollection[name] : SPField
    name: DisplayName
  • SPFieldCollection.GetField(name) : SPField
    name: internalName, displayName or internalName and displayName from the current context
  • SPFieldCollection.GetFieldByInternalName(name) : SPField
    name: internalName
  • SPFieldCollection.ContainsField(name) : bool
    name
    : displayName or internalName
  • SPListItem[name] : object
    name: internalName, displayName or internalName and displayName from the current context
  • SPListItem.GetFormattedValue(name) : string
    name: internalName, displayName or internalName and displayName from the current context

Sunday, November 23, 2008

Whats New in Share Point Server 3.0?

Built in Breadcrumbs

Site Navigation

Security - What you see is what you've got access to. This makes it a bit easier on the admins, so they don't have to explain why a user clicks a resource, needs to enter a username and password, tries 3 times and fails and then will be shown an error page... If you don't have access to the resource it will not be shown in WSS 3.0. Whoopdie doo for us!

File-based Permissions

No deny permission, unfortunately.

Document Collaboration - This is a huge advantage with the 3.0 version (I'm not sure how it used to work with 2.0 or if it exists in that version, but in this version it rocks). It supports Major and Minor versioning which basically means that if you make a "minor" change to a document it will not be seen by the user. However, when you publish the document to a "Major" version it will become known and seen by the users. It supports Document Properties, something that can come in handy when searching. (I'll get to the search part soon). Workflows, the name says it all doesn't it. Templates (Word 2007), Policies...

Search Indexer that also indexes the Document Properties (as mentioned above). The search functionality is no longer based on the SQL Server but it's own index generated by the database. WSS 3.0 has a searchbox

WIKI. You probably know what a wiki is already and most of you probably have slightly different opinions as to what a wiki is excactly. My opinion is that it's a public "document library" (find me a better term..) that anyone can edit and add information to. You can link from one thing in the WSS 3.0 wiki to another by using real wiki-commands such as [[Tobias Zimmergren]] and it will create a link. If the link doesn't exist, it will be a link with dashed bottom-border. When you click the link it will ask you to put some info in about the link. And that's basically how it works. All you should really need to know, is that there's support for a nice wiki.

Blog. It supports your own blog. A blog is a Web-log and I bet you all know what that means. (I'm writing a blog entry right now)


For More details fine the below links.

http://office.microsoft.com/en-us/sharepointtechnology/HA100738471033.aspx

http://www.sharepointblogs.com/zimmer/archive/2006/10/06/what-s-new-in-wss-3-0-and-sharepoint-server-2007.aspx

Install Windows SharePoint Services 3.0 Tools on XP HACK

This is a hack to install SharePoint Services 3.0-Visual Studio 2005 Extensions on XP machine. For this we need to add/modify the following registry key.

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\12.0]
"Sharepoint"="Installed"


Link for Visual Studio extensions
Windows SharePoint Services 3.0 Tools: Visual Studio 2005 Extensions (VSeWSS)


I have tested it on XP on it is working fine. The same works fine for VISTA as well

Thursday, November 20, 2008

variables for Alerts

I'm currently creating custom alert templates for WSS 3.0 / MOSS 2007. I noticed you can use a GetVar element for obtaining properties of the item that triggered the alert, i.e.:


AlertFrequency - The time interval for sending an alert. Possible values include 0 (immediate), 1 (daily), or 2 (weekly).
EventType - The type of event. Possible values include 1 (item added), 2 (item modified), 4 (item deleted), 16 (discussion added), 32 (discussion modified), 64 (discussion deleted), 128 (discussion closed), and 256 (discussion activated).
ItemName - The title of the item.
ItemUrl - The absolute URL for the item.
ListName - The name of the list.
ListUrl - The absolute URL for the list.
ModifiedBy - The display name of the user who modified the item.
MySubsUrl - The absolute URL for the My Alerts on this Site page in Site Settings.
SiteLanguage - The locale identifier (LCID) for the language used on the site. For example, 1033 is the LCID for U.S. English.
SiteName - The title of the site.
SiteUrl - The absolute URL for the site.
TimeLastModified - The time at which the item was last modified.

Codeplex tools for sharepoint

Share point SUSHI

SUSHI is a powerful, user-friendly Share Point application enabling you to accomplish common Share Point administrative and development tasks. You can think of SUSHI as a Swiss army knife for Share Point. What does the name SUSHI stand for? SUSHI = Share Point Utility with a Smart, Helpful Interface

http://www.codeplex.com/sushi

Share Point Content Deployment Wizard

The Share Point Content Deployment Wizard is a tool for Share Point 2007 which provides the means to deploy the following content:
- site collections
- Webs
- lists
- Folders
- List items (including files)

http://www.codeplex.com/SPDeploymentWizard

Simple tools for Share point 2007 Development(STSDEV )

http://www.codeplex.com/stsdev

Share Point Manager 2007

The Share Point Manager 2007 is a Share Point object model explorer. It enables you to browse every site on the local farm and view every property. It also enables you to change the properties (at your own risk). This is a very powerful tool for developers that like to know what the Share Point holds of secrets.

http://www.codeplex.com/spm

SharePoint AJAX Toolkit

http://www.codeplex.com/sharepointajax

SharePoint developer Toolbox

The follwoing are the some of the useful tools for sharepoint and general web development.

CAML Builder:

http://weblogs.asp.net/jan/archive/2008/05/28/new-version-of-the-caml-query-builder-tool.aspx

Internet Developer Toolbar:

http://www.microsoft.com/downloads/details.aspx?familyid=e59c3964-672d-4511-bb3e-2d5e1db91038&displaylang=en

Firebug

https://addons.mozilla.org/en-US/firefox/addon/1843

Google Chrome( comes with document inspector )

Chrome

WSPBuilder

http://www.codeplex.com/wspbuilder

BDCMetaMan


http://www.lightningtools.com/default.aspx


Form Based Authentication for SharePoint

Scenario:
You want to configure Form Based Authentication ( FBA ) for the a group of users.

Solution:
Again , SharePoint is nothing but ASP.Net application, so the process is almost the same for SharePoint. Also SharePoint comes with its own Login.aspx page Out-Of-Box , so no need to design one.

Article:

http://msdn.microsoft.com/en-us/library/bb975136.aspx ( 3 Part series )

http://www.simple-talk.com/dotnet/windows-forms/configuring-forms-authentication-in-sharepoint2007/

http://www.codeplex.com/fbahttp://blogs.msdn.com/harsh/archive/2007/01/10/forms-based-authentication-in-moss.aspx