Fast Search Server 2010 for SharePoint –how to drop document from index by its url using Content API and search service.

by Kai 23. May 2012 21:20

Hi 2 all, in this post I am going to show how to drop document from index by its url from .NET code. Of course, you can use docpush tool for this purposes, but you can also do it using Content API from code –

“The Content API for Microsoft FAST Search Server 2010 for SharePoint enables your application to add and remove indexed content within Microsoft FAST Search Server 2010 for SharePoint using the Microsoft .NET Framework. ”

Content API you can download from here (it contains some examples how to use it). Content API has method RemoveDocument that accepts document’s id (this contentid actually). But we have only url, so we must query our document using search service by url, get contentid property and drop it eventually. Lets start (full project at the end of the post).More...

Tags: , , ,

SharePoint 2010 | Fast Search Server 2010

SharePoint 2010 modal dialog extensions

by Kai 28. April 2012 02:26

Hi all. During digging into different sharepoint *.debug.js files I also investigating into sp.ui.dialog.debug.js. Out of the box modal dialog framework has some number of methods for manipulating dialog window, but some methods (that might be useful) missed. For example programmatically maximize or restore dialog window. Here is a couple of extension methods that I’ve created:

  • maximize -  maximizes modal dialog window
  • restore -  restores modal dialog window
  • toggleView – maximizes if modal dialog window is not maximized and vice versa
  • setSize – set size for modal dialog window (height, width in pixels)

Here is the code:

ExecuteOrDelayUntilScriptLoaded(function(){
	SP.UI.ModalDialog.prototype.toggleView = function () {
		this.$z(null);
	};
	SP.UI.ModalDialog.prototype.maximize = function (){
		if(!this.$S_0){
			this.$z(null);
		}
	}
	SP.UI.ModalDialog.prototype.restore = function (){
		if(this.$S_0){
			this.$z(null);
		}
	}
	SP.UI.ModalDialog.prototype.setSize = function (width, height){
		if(typeof width == "number" && typeof height == "number") {
			this.$Q_0(width, height);
		}
	}
}, "sp.ui.dialog.js");

Example of use:

var dlg = SP.UI.ModalDialog.get_childDialog();
dlg.toggleView();

Enjoy and good luck in spdevelopment.

Tags: , , , ,

SharePoint 2010 | JavaScript

How to find correct javascript handler for OOB SharePoint ribbon button.

by Kai 21. March 2012 00:47

Hi all!

You clicked ribbon buttons a lot in SharePoint 2010. Sometimes, you as developer are interested in what code is executed when particular button is clicked. I’m going to show how you can easily find particular js handler for any ribbon button. For example, imagine you want to find what code is fire when you click “Edit HTML Source” drop down button in a rich text editor. First of all inspect this element using firebug, or any favorite browser’s dev tool:

image

Consider id attribute - Ribbon.EditingTools.CPEditTab.Markup.Html.Menu.Html.EditSource-Menu16. Next go to 14 hive and under TEMPLATE\GLOBAL\XML\ find cmdui.xml file. This file contains definition for all ribbon buttons in SharePoint. Search in this file by word Ribbon.EditingTools.CPEditTab.Markup.Html.Menu.Html.EditSource, you’ll find this definition:

image

More...

Tags: , , , ,

SharePoint 2010 | JavaScript

How to force SharePoint to load *.debug.js versions of JavaScript files.

by Kai 20. March 2012 23:39

Hi all!

Sometimes during spdevelopment you may need to dig into OOB SharePoint javascript files and look how they work. As you may know, under layouts folder in 14 hive there are also debug versions of javascript files. When you are debugging you solution in visual studio by pressing F5 it might automatically replace standard js files with it debug versions, so you can set up breakpoint in OOB js files and try to debug. But what if you aren’t using F5 debugging, or want to force SharePoint to load debug versions in all site collections by default? You have two options here.

One option is to modify web.config for particular web application, so all sites under this web app will be automatically load debug versions of javascript files (and this is pretty cool for developer machine). You need to modify compilation tag and set attribute debug to true.

Another option is not to modify web.config, but to modify master page. Every SharePoint master page contains ScriptManager tag. It has ScriptMode attribute that is Auto by default (or if not presented). You can set it up to Debug.

Result will be the same as for web.config, but only for one particular site, where you customize master page. This should be sufficient, but if it is not working, try also modify web.config. And, of course, do it only on developer machine. 

Hope this tip helps and as usual good luck in spdevelopment!

Tags: , ,

SharePoint 2010

Creating InfoPath association (or instantiation) form for SharePoint 2010 Visual Studio workflow

by Kai 7. March 2012 12:07

Hi all! I’ve started exploring workflows and want to show how to create an InfoPath association form (and this tutorial also can be used to create an instantiation form, because it’s very similar process) for SharePoint 2010 Visual Studio workflow. This task is not very straight forward, and with its caveats. I’ll try to write detailed as possible guide and explain all possible pitfalls when creating form and link it with visual studio. Ok, lets start.

1. Creating and setting up an InfoPath 2010 form.

I’m going to create a very basic form, just to demonstrate how it works, but this can be a starting point for you. Run InfoPath Designer, click new, select blank form  and then design form, your empty form should look like this one:

image

Next insert a table, add a label, a texbox and two buttons. First button is Ok button, and the second is the Cancel:

More...

Tags: , , ,

InfoPath | SharePoint 2010 | Visual Studio | Workflow