Add scrollbar to SPAutocomplete in Spservices

Add scollbar to autocomplete in spservice is easy.We need to overtire css.

$().SPServices.SPAutocomplete({
sourceList: “Product”,
sourceColumn: “LinkTitle”,
columnName: “txtNewProductValue”,
filterType: “Contains”,
CAMLQuery: camlQuery ,
highlightClass: “ms-bold”,
uniqueVals: true,
ignoreCase: true,
numChars: 1,
slideDownSpeed:”fast”,
debug: true,

});

//add css for add scrollbar
$(‘#SPAutocomplete_’).css({“max-height”:”150px”,”overflow-y”:”auto”,”overflow-x”:”hidden”});
}

Output is

scrollbar

Advertisements

Fire Workflow by system account?

I am back after 2 months ….Today we release project in SharePoint 2010 .

In this project we had one module that convert document from one format to another .Each document need to be approve by Approval administrator .

images (1)

SharePoint converting document using system account ,we stuck here for how to fire WORKFLOW by system account?

 

I had spent more time to find this solution and we find solution that in event receiver fire WORKFLOW through code.

 

Here is the code ….

 

SPWorkflowAssociation wfAssoc = spfileNewFile.Item.ParentList.WorkflowAssociations.GetAssociationByName(workflowName, System.Globalization.CultureInfo.CurrentCulture);

spfileNewFile.Item.Web.Site.WorkflowManager.StartWorkflow(spfileNewFile.Item, wfAssoc, wfAssoc.AssociationData, true);

spfileNewFile.Update();

 

 

Lets explore Word Automation Service

The great feature introduce in SharePoint 2010 .Do you want to convert one file format to another ,this is right place .You can use it to convert a .doc or .docx document into an .xps or .pdf file.

The following list shows the supported input formats:

  • Open XML File Format documents (.docx, .docm, .dotx, .dotm)
  • Word 97-2003 documents (.doc, .dot)
  • Rich Text Format files (.rtf)
  • Webpages (.htm, .html, .mht, .mhtml)
  • Word 2003 XML Documents (.xml)
  • Rich Text Format files (.rtf)
  • Webpages (.htm, .html, .mht, .mhtml)
  • Word 2003 XML Documents (.xml)
  • Portable Document Format (.pdf)
  • Open XML Paper Specification (.xps)

Lets see example of converts a document from .DOC to .XPS by using the Server Object Model of the Word Automation Services

Sample Code:

SPFile sourceFile = web.GetFile(“Shared%20Documents/Source.doc”);
ConversionJob job = new ConversionJob(wordAutomationServiceName);
job.UserToken = site.UserToken;
job.Settings.UpdateFields = true;
job.Settings.OutputFormat = SaveFormat.XPS;

String sourceUrl = web.Url + “/” + sourceFile.Url;
String destinationUrl = web.Url + “/” +
sourceFile.Url.Replace(“.doc”, “.xps”);
job.AddFile(sourceUrl, destinationUrl);
job.Start();

Event Recivers

SharePoint provides event receivers to work with list.documents,email etc.

There are Synchronous and asynchronous events.

Synchronous event :means before the action.itemadding,temCheckingIn etc

Asnchronous event :means after the action.ItemDeleted,ItemFileConverted etc

Item-Level Event Receivers
ItemAdded -Occurs after an item has been added to a list.
ItemAdding– Occurs before an item is going to be added to a list.
ItemAttachmentAdded -Occurs after an attachment has been added to a list item.
ItemAttachmentAdding -Occurs before an attachment is going to be added to a list item.
ItemAttachmentDeleted -Occurs after an attachment has been deleted from a list item.
ItemAttachmentDeleting– Occurs before an attachment is going to be deleted from a list item.
ItemCheckedIn– Occurs after an item has been checked into a list.
ItemCheckedOut -Occurs after an item has been checked out from a list.
ItemCheckingIn -Occurs before an item is going to be checked into a list.
ItemCheckingOut -Occurs before an item is going to be checked out from a list.
ItemDeleted– Occurs after an item has been deleted from a list.
ItemDeleting -Occurs before an item is going to be deleted from a list.
ItemFileConverted– Occurs after a file has been converted using document conversion
services.
ItemFileMoved -Occurs after an item has been moved.
ItemFileMoving -Occurs before an item is going to be moved.
ItemUncheckedOut -Occurs after an item has been unchecked out from a list.
ItemUncheckingOut- Occurs before an item is going to be unchecked out from a list.
ItemUpdated -Occurs after an item has been updated from a list.
ItemUpdating -Occurs before an item is going to be updated from

Workflow Event Receivers

WorkflowCompleted– Occurs after a workflow instance is completed.
WorkflowPostponed -Occurs after a workflow instance has been postponed.
WorkflowStarted -Occurs after a workflow instance has been started.
WorkflowStarting– Occurs after a workflow instance is starting.