Friday, March 5, 2010

K2 [blackpoint] & Web service

Problem
Determine manager of AD group dynamically in K2 [blackpoint]

Scenario
User A starts a K2 workflow (this makes the user “originator” of the workflow). This user belongs to an Active Directory group “ABC”. Manager property is not set, but group “ABC” has “Managed By” value set. Question is how to get the manager of the group and use it as a destination in K2 [blackpoint]?

Resolution Scenario
Possible resolution to this problem is using web service, consumed in K2 process. This service can:
1. Get workflow originator name as an income parameter
2. Determine the AD group, this user belongs to
3. Search for the manager of this group
4. Return the manager as a result (XML)
Once these steps are complete (and the service is published), it could be consumed from K2 [blackpoint] and the result used as a destination in an activity.


Web service
Creating a web service is simple – open Visual Studio, select to create a new project and choose select “ASP .NET Web Service Application” as a project template.


When the project is ready, include as a reference System.DirectoryServices namespace. This namespace provides access to Active Directory Domain Services.
There are 2 options (at least) to get AD group to which the user belongs to.

Option 1: Get the “Canonical name” and parse the result to extract group names:



Option 2: Get the list with groups where the user is a member:


Note that there is one method used above when creating search filter - “ExtractUserName”. This method does nothing more, but removing domain prefix from the name of the user to make it in a proper format for filter. In other words, if the input name looks like this: “domain\UserA”, this method will return only “UserA”.
Assuming that we already have the list with groups where “User A” belongs to, and group “ABC” is located, the next task is to get the manager of this group. This time we are interested in “Managed By” value, which can be extracted with “managedBy” property:


When the manager is determined, it is time to prepare the service response. Since this service will be consumed by K2, the response can only contain simple data types – string, double, Boolean etc. In order to return more complex results, the data can be presented as a XML string. Below is shown how to use both simple sting and XML as a response.

Case 1: Simple string
In this case the response returned is just the result – manager.

Case 2: XML string
This more complex scenario includes 2 steps:
1. Build the response:



2. Prepare XML definition file (XSD) to define the structure of the K2 filed that will keep the response:



K2 [blackpoint]

Add data fields for the response
Since we defined 2 cases (simple string and XML string):

Case 1: Simple string
To add a string field, expand Object Browser in K2 Studio, locate “Process/Activity Data” tab, select “Data Fields”, right click on the process name and select add. When “Add Data Field” window opens, type the name (“SimpleServiceResponse” in our case), make sure that “String” is selected as “Data Type” and click OK.



Case 2: XML string
Follow the steps from Case 1, but now, instead of “Data Fields”, select “XML Fields”. Type the name of the new field (“XMLServiceResponce”). Then open “XML Schema” tab, and browse for the schema file created above.


Once the schema is loaded, click on Initial Value tab and select Generate Sample XML file. Make sure that the file looks fine and click “OK”.



Get service response
First have to add a reference to the service. To do this, click on References button in K2 studio toolbar.


When Manage Project References window opens, select “Add” and click on “Web” tab. Type the address of the service and click on “Discover” button.


When “Web service discovered successfully” message appears, click on “Select” to add it as a reference. Close Manage Project References window.
From event wizards panel select Reference event and drag it on designer canvas. Click “Next” till “Event Method Editor” page opens and select “Add”. Expand the reference node till “Constructor()” is shown, select it and click Next.


No changes are needed in the next step for our case, so click “Finish”. Event Method Editor window should look like this:


Select the line defining the constructor and click on Add once again. This time “Select a Method” window opens. Locate the method needed and click on Next.


On “Configure Method Call” page assign the income parameters (Originator Name in our case) and the outcome parameter (either “SimpleServiceResponce” or “XMLServiceResponce”).


Click Next, and then Finish.

Usage

Case 1: Simple string
In this case the field contains the name of the manager that has to be used as an activity destination. To add it as a destination in iTechnology Forms Accelerator event (or other client event), expand Event Wizards panel, locate iTechnology Forms Accelerator event and drag it on the canvas. Follow the wizard till “Destination Users” page. There click on Add to add new destination rule, click on select object button and open “Process/Activity Data” tab. There expand Data Fields node and locate the field used above to keep simple data response (“SimpleServiceResponce”). Click on “Add”.


Note that “User” has to be selected as a destination type.

Case 2: XML string
The only difference from Case 1 is that this time you have to expand “XML Fields” node and locate the XML field used to store the compose service response (“XMLServiceResponce”). Expand this field to locate the proper node before assigning it as a destination rule.


The result should look like this:



Notes
1. Information in the field, populated by calling a web service method is static. This means that if you need to update/check it at some other point of time, you need to update it by adding additional reference events before using it again.
Read more on this article...
Bookmark and Share

Tuesday, February 9, 2010

ASP.NET MVC: Create Facebook-like search box

By Hristo Yankov
 
In today's article I will show you how to create your own Facebook-like (or LinkedIn-like) search box. If you haven't seen what it looks like, here is an example:

 
You will notice that it features: autocomplete, icon, matches what you type and when you click a result item, it takes you to the appropriate page. That's what our control in MVC will feature too. We will implement this in ASP.NET MVC2 and jQuery.


The Plan:
We will create an attribute and use it to decorate the action methods of our controllers. When we decorate an action, we will be adding metadata, such as the display name it should appear with in the search results and an optional icon. When the user types something in the search control, we will use jQuery to POST to a special controller, which will be enumerating all action methods in all controllers. While enumerating, it will be looking for a match between the search query and the metadata of each 'indexed' action method.

Implementation

Note: You can download the working demo project from here

Visit the project page here: http://yankov.us/#Projects

The Attribute
Ok, let's start with the attribute. In your Code folder (if you don't have one - go ahead and create it) add a new class and name it 'ActivitySearchAttribute'. It will have two string properties - Text and ImageUrl. Implement it like that:


This is the attribute we will be using to decorate our action methods in the controllers. That way we will mark them as 'searchable'.

Action-Method Decorations
Let's create a couple of dummy controllers, with a couple of actions in each of them and decorate them with the newly created attribute. Like this:

 

As you can see, the icon property ("group.png" in the example) in the metadata is optional. Non-decorated action methods will not be returned as search results.

The Search Controller
Now let's implement the search controller. Basically, what it will be doing is: receive a query string (e.g. "the", as in the first image of this post), get all controllers, enumerate the action method of each controller, match the 'Text' property of the 'ActivitySearch' attribute (which we use to decorate the action) and then return an array of the matches with the appropriate URL to each result. Just like Facebook. I won't paste the code here, as it is big, but you will find it in the attached sample project. The file is in Controllers and is named "SearchController.cs".

Json Response
The search will be a dynamic thing. While the user types, we will be sending a request to a controller and we will be receiving a response. We need to create a class which we will serialize to JSON and use it as a response. In your Code folder, create another class and name it 'ActivitySearchResultItem'. It will have three properties: Text, Url and Image. Implement it like that:

The Search controller will be returning an array of those, to the jQuery UI, as a JSON response.

The JavaScript / jQuery
Now, when we have the back-end, we just need to implement the front-end in jQuery and html. Note that our solution will be using a 3rd party library - jquery.autocomplete.pack.js
Additionally, we will put our javascript, in a file named "activitySearch.js".

The auto-complete jQuery plugin will take care of attaching to the text-box and submitting/receiving data to/from the back-end controller. We just need to process and format the results. When the user clicks a result, he will be redirected to the URL property associated with the result item (see 'Json Response' above). Like that:


As you can see, the jQuery code expects that if there is an Image associated with the search result it should be in the /Content/images folder.

HTML
Here is how to setup your page which will contain the search-box control.


Conclusion
Now, when you have everything in place, start the project and just type in the search box some phrase which you know will hit a result. You should see something like:


The search results are clickable and when clicked, it will take you to the appropriate action. You can optimize the whole solution with various caching settings and techniques.

You can download the whole demo project here.
Read more on this article...
Bookmark and Share

Friday, February 5, 2010

ASP.NET MVC2 - Creating a Display Template

By Hristo Yankov
 
ASP.NET MVC philosophy is "Skinny Controller, Fat Model, Stupid View". The focus of today's post is "stupid view". What does this mean? Well, it means that you should avoid writing any logic in your views. A view should be as simple as wrapping the model's properties in html tags.

If you are cornered, and must have some kind of a login in your view, it would be nice if it is neatly wrapped in a DisplayTemplate, so your code remains reusable, easy to read and maintain. What follows now is a tutorial on how to create one.


Problem: We have a Model which has a property "RemainingTime", which is an integer and represents the estimated remaining seconds of some operation. We want to neatly format this time in the view, so that if it has a value of, let's say, "5", to be displayed as "5 seconds". If it has value of "70", to be displayed as "1 min, 10 seconds", etc...

Solution: Create a reusable DisplayTemplate and use it to visualize the property.

We start by creating a new ASP.NET MVC2 "empty" project template. We don't need the default authentication and home controllers, so that would do just fine.

As a first step, let's create our Model. We'll call it "RemainingTimeModel" and will have the integer property "EstimatedSeconds". We will name the DisplayTemplate "SecondsFormatting". So we go ahead and decorate the "EstimatedSeconds" property with the UIHint attribute, passing "SecondsFormatting" (which is the name of the DisplayTemplate we want to use) in its constructor. This attribute tells ASP.NET MVC which DisplayTemplate to use by default, for this property. Your code should look like this:




Second step is to create the actual DisplayTemplate. It needs to reside in the "Views/Shared/DisplayTemplates" folder, and be named "SecondsFormatting.ascx". So, create a "DisplayTemplates" folder in your Shared views, then right click it and Add -> View. Check the 'create partial view' checkbox and give it the name we mentioned above. By default, this will create non-strongly typed ViewUserControl. We will extend this, to an integer. Open the "SecondsFormatting.ascx" file and change the Inherits="System.Web.Mvc.ViewUserControl" to Inherits="System.Web.Mvc.ViewUserControl". Now, when you refer to the Model object in this control, you are working with an integer. The Model that will be passed to this DisplayTemplate is the "EstimatedSeconds" property of the "RemainingTimeModel" model.

Now we just need to implement some logic in the control. Let's do this:



Ok, we have the model, which has the seconds property, and we have a DisplayTemplate for it. Now we jsut need to use it. For this purpose, we will create one simple controller, which creates a new instance of the model and initializes it, then passes the model to a view. In the view, we will have: Html.DisplayFor(model => model.EstimatedSeconds). Like that:

(Controller)



(View)



See how clean your View remains? No logic in there, just a DisplayFor html helper call.

We can now go ahead and try it out, with a couple of different values. It formats it accordingly. Please note that there are much easier ways to format the time and it was used here just as an example of what we should do if our view requires to have a logic. If we try with 3732 seconds, it should display "1 hours, 2 minutes, 12 seconds".

Now you know how to encapsulate your logic in DisplayTemplates and keep your main Views clean and neat.


You can download the demo project from here.
Read more on this article...
Bookmark and Share

Monday, January 25, 2010

iTFA v2.0.5

Version 2.0.5 of iTechnology Forms Accelerator is now released.

This version contains a fix for "Discover Orphan Instances" timer job issue. If you have messages like this in Event Log: Invalid object name 'dbo.iTFAFormInsts' or like the one described in this post, then you definitely need to apply the patch.

iTechnology Forms Accelerator v2.0.5 can be downloaded as a full installation package or as a patch. The patch has to be applied over version 2.0.4, while the full installation package is for users that install iTFA for first time. You can download them from our website. Packages contain installation/upgrade files and installation documentation.

Any problems can be reported in iTechnology Support Forum. Read more on this article...
Bookmark and Share

Wednesday, January 13, 2010

Issue fixed: SharePoint fields are not displayed in iTFA Form

Patch 2.0.4 of iTechnology Forms Accelerator was released yesterday. This patch fixes the issue reported in iTechnology Support Forum - Empty Form when item created by email. Similar issues were discovered with list items, created out of iTFA system from other external programs. The patch is available for download on iTechnology web site.
Patch 2.0.4 has to be applied only after v2.0.3 is installed. More information about 2.0.3 can be found in this post.

Now let's review how to install iTFA v2.0.4. The patch consists of one DLL - iTechnology.Forms.Runtime. To install it is as simple, as 1-2-3:

1. Unzip iTFA patch 2.0.4
2. Locate iTechnology.Forms.Runtime.dll and install it to GAC of all SharePoint servers where iTechnology Forms Accelerator is installed and deployed
3. Run IISRESET command for all SharePoint servers that are updated

Enjoy!

P.S: Any issues found, regarding iTechnology Forms Accelerator can be submitted in iTechnology Support Forum. We are always doing our best to help you resolve them and improve iTFA. Read more on this article...
Bookmark and Share

Monday, December 21, 2009

iTechnology has released iTFA 2.0.3

iTechnology has released an updated version of iTFA. The 2.0.3 patch includes a number of improvements such as SharePoint workflow automation fix and K2/SharePoint action integration.

We also improved the Designer by:
  • Fixing fields overlapping
  • Fixed some Service communication problems
  • Implemented Drag and Drop and User Interfaces fixes
  • Fixed boundaries issue
  • Implemented fixes for AddMinutes and AddHours calculations
The new patch is available for download on our website after registration. Note that you can apply the 2.0.3 patch only over iTFA version 2.0.2. Read more on this article...
Bookmark and Share

Friday, November 27, 2009

Anonymous access to forms - the iTFA way

There are times when your anonymous user might need to submit data to you in SharePoint. You already know the best way to create forms is ... ta-daaa ... iTechnology Forms Accelerator (I know, I know ... shame on me for the free self-compliments ...).


After the shameless self-advertising campaign you saw let's get our hands dirty; the step-by-step way:




1. IIS


Yes, you probably know this but in order to access anonymously *any* ASP.NET website, IIS needs to be configured. Here you can find how to do it with Windows Server 2003 and IIS 6. The key element to remember here is the IUSER_ComputerName account which is assigned to every anonymous visitor to your website which later on we will see how to use it in iTFA.


2. SharePoint Central Administration


Going down the drain - MOSS. Let's go to Central Administration, then Application Management and open up Authentication Providers. Here is the time to mention iTFA works best with Windows Authentication so lets enable anonymous access to the Windows membership provider.


3. SharePoint site


IIS set, provider set. Next level? Right - site. In the site where you host your iTFA-enabled forms in Site Actions menu open up Site settings and follow the Advanced permissions link. In the page's toolbar you will see Settings item and Anonymous Access subitem - click on it. Here you can enable anonymous access to the whole site or only to libraries and lists - your choice here!




4. iTFA Management site


So far, so good. 3 done, 2 to go. In order for iTFA to be sure that you are 100% percent aware which users have the required access level we have added user access functionality. You can see how to play with it by watching our short video here. Fast forward now and go to "itfa" management site in SharePoint and User Access configuration section there. Let's focus on anonymity now. Remember user IUSER_ComputerName from step 1? Here is why I have told you to keep it in mind! You need to add it to any of the 4 groups that you see in order your anonymous users to access iTFA forms. I wouldn't recommend adding this user to any other group than iTFA Users because you will be giving your anonymous guests way too much power and honestly speaking - they don't deserve it. ;-)


5. My iTFA-enabled list (document library)


Tired? Bored? Bear with me please, you are just few clicks away from having your perfectly anonymous guests access your forms!


I know the first thing you did was to watch our Hello World video (if you have missed it, you can watch it here) where you have iTFA enabled a custom list (btw the same way you do it for document library). Now let's get those anonymous users see your shiny-easy-to-use-5-minute-built new form.


Open up your list, go to Settings -> List Settings -> Permissions for this list. In the Settings menu item click on Anonymous Access. Now you get to choose what permissions your anonymous users will have - Add / Edit / Delete / View. View is selected by default but enabling any of the other options will change the list's View page with the required functionality. Let's check them all and rock on.


Here I need to mention that if you are in document library and all the other options are grayed out, there is a nice workaround to enable them. Take a look at the URL of this page you will notice that after the .aspx page there is a query "obj=%listidhere….." followed by "DOCLIB". If you change this last part of the URL from "DOCLIB" to "LIST", you will notice that you now have all of the option that you've been missing. Note that by changing the URL query in your browser you are not damaging your library in any way. You are just telling SharePoint to present you with the anonymous access settings available for a list. You can change the setting back to the default by deselecting the "Add, Edit & Delete" options.


6. Finish line


Finished! Yes, I know it took less than 5 minutes, just like with everything else you do with iTechnology Forms Accelerator... Peace of cake, huh?!
Read more on this article...
Bookmark and Share

Thursday, November 26, 2009

SharePoint Console Application Requirements

By Hristo Yankov

So you have written a Console application which is working with the SharePoint Object Model (API), but you get an error. Something similar to:
Cannot open database "WSS_Content_{GUID}" requested by the login. The login failed.
Login failed for user 'DOMAIN\User'.

Or (* see additional notes below!):
FileNotFoundException: The web application at http://some.site could not be found. Verify that you have typed the URL correctly. If the URL should be serving existing content, the system administrator may need to add a new request URL mapping to the intended application.


That's because there are a couple of security requirements you need to meet. Basically, the user who is running the console application needs to:
  • Be an Administrator on the computer he is running the app from (certainly, that would be the SharePoint server). Just add the user to the (Local) Administrators group on the machine.
  • Have sufficient rights within the SharePoint site. If you are doing some administrative tasks, you would want this user to be given "Full Control" (group).
  • Needs to have read/write permissions on the content database in the SQL server (or just make it db.owner). The database name is usually WSS_Content_{GUID}.
After you have given those rights to the console application executing user, it should run fine. And by the way, if you think you can avoid giving those permissions, by running the API calls within SPSecurity.RunWithElevatedPrivileges, you are wrong. The call itself, to SPSecurity.RunWithElevatedPrivileges would require them.

* Additional note about FileNotFound:
Although this is not covered by this article, there might be other reasons for this error. For example: Site collection not existing on this location or you need to add Alternate Access Mapping.

Well, I hope this helps someone out there,
Hristo Yankov
Read more on this article...
Bookmark and Share

Wednesday, November 18, 2009

jQuery in SharePoint

By Hristo Yankov





There are rumors jQuery might be included as part of SharePoint 2010. In an anticipation for that, today's article aims to show what the integration between SharePoint 2007 and jQuery looks like, how to use it and what are the benefits.

So what is jQuery?
jQuery is a lightweight JavaScript library that emphasizes interaction between JavaScript and HTML. It was released in January 2006 at BarCamp NYC by John Resig. jQuery is free, open source software Dual-licensed under the MIT License and the GNU General Public License. Microsoft and Nokia have announced plans to bundle jQuery on their platforms, Microsoft adopting it initially within Visual Studio for use within Microsoft's ASP.NET AJAX framework and ASP.NET MVC Framework whilst Nokia will integrate it into their Web Run-Time platform.

Simply put, it is a high performance rapid development, AJAX-enabled library on top of JavaScript.


API
There are a lot of articles and tutorials out there, on how to use jQuery in general. Here is the most essential documentation you will need - the jQuery API.

SharePoint integration
Integration between jQuery and SharePoint boils down to finding a smart way to get a jQuery reference in your pages.

Basically you can do this 'manually', which is well described here or you can use an automated integration solution (see below).

The manual approach essentially consists of two steps:
1) Deploying the libraries (js) to a location which can be accessed by the pages - that would be the LAYOUTS folder in the 12 hive
2) Loading the libraries on the pages - by modifying the master page, load the library specifically in the page you want to use it or other... It is all well described in the posted article.

The automated solution is a better one. You can get "SmartTools jQueryLoader for SharePoint" which does the integration for you. There is a good article which walks you through the installation process, so we are not going to that here. Make sure you watch the video, though.



Just try it out

If you just want to quickly try the magic of jQuery in SharePoint out, without bothering with the full integration you can do what is described here. The example in this article uses jQuery library which is hosted on Google Code (rather than in your 12 hive) and it dynamically queries the SharePoint web service to retrieve your current tasks, then visualizes them on the page. No need to develop a web part, it is just as simple as that!

You should also check this out, although for some reason I couldn't get it to work. Basically this is supposed to let you test any jQuery code, from a small 'editor' on your home page.


Benefits
So what are the benefits of using jQuery in SharePoint?

AJAX
Well, obviously it adds AJAX functionality to your SharePoint web application. You can now retrieve and visualize data asynchronously, without putting any load on the SharePoint server. It also allows you to create more appealing and faster UI.

Page elements control and flexibility
Additionally, SharePoint allows you to change content structure for subsites, lists, libraries, views, columns, content types and the Web parts, but sometimes that's not enough. Sometimes developers/designers or users need to make changes to the functionality and appearance of a SharePoint site in a way that is not allowed by the IT department. Since SharePoint Designer is usually restricted, we need an alternative way. That would be jQuery. Just to give you a concrete example of such situation, here is a guy who had to make the corners of the quick launch menu rounded.

jQuery saves development time
jQuery simplifies the way you traverse HTML documents, handle events, perform animations, and add Ajax interactions to your web pages. To summarize it one sentence only: couple of lines in jQuery allow you to do better what you could do with over 20 lines of JavaScript.

Many other...
  • You don't have to check for null objects
  • CSS3 compliant and has a great CSS selector integration
  • Huge community which supports it. Many tutorials out there...
  • Simple and fast development
  • Lightweight!
  • etc...

Performance
jQuery 1.3 is fast. As in the "fastest JS framework out there". Here are some nice tips on how to write a fast jQuery code.


Debugging jQuery in SharePoint
FireBug is the preferred way to debug jQuery (and JavaScript in general). Here is a nice article which goes into details.


Examples
http://www.endusersharepoint.com/ - THE "jQuery & SharePoint" website.
jQuery sparklines
Showing random images in SharePoint 2007 using jQuery
Highlight SharePoint List rows conditionally
Paging large content in SharePoint using jQuery
Many other...


Read more on this article...
Bookmark and Share

Saturday, November 14, 2009

SPUG Orange County Nov 18: Forms in SharePoint

By Dmitry Ivahno

If you are in Orange County, CA or nearby, please don't miss an opportunity to visit SharePoint User Group meeting next Wednesday. The topic: "Forms in SharePoint".

This session will be of interest to both InfoPath and iTechnology forms users and designers and will help them make educated decisions when deciding which product to use. Also part of the presentation will display Forms integration with K2 workflow.

More information about iTechnology Forms Accelerator can be found here:
http://blog.myitechnology.com/2009/11/introducing-itechnology-forms.html

To register for SPUG Orange County meeting please visit its website:
http://www.officezealot.com/GroupZ/spug_ca_oc/Pages/default.aspx

Event details:
Location: QuickStart, 16815 Von Karman Ave, Suite 100, Irvine, CA 92606
Time: 11/18/2009 6:30 PM to 8:30 PM PST

Read more on this article...
Bookmark and Share

Monday, November 2, 2009

Introducing iTechnology Forms Accelerator 2

By Dmitry Ivahno

According to Gartner, 50% of the enterprises they surveyed use MOSS 2007 or WSS 3. Today millions of people have relied on Microsoft SharePoint technology for collaboration, records management, enterprise search, or other integration functions. We all know that SharePoint is both an ECM product suite and a great framework for building customized solutions. However, there's always been one problem: Once you're on the path of tailoring SharePoint to your business needs, customization of SharePoint just isn't that easy to use for non-IT professionals. Whenever you need to create a business process SharePoint Designer workflow is very limited or designed for software developers; Or you may decide to have electronic forms and use InfoPath, which is a great product. However, in case of Microsoft InfoPath, it has too many advanced features and over-complicated designer that put you in a risk of breaking a working solution. In general if you start customizing SharePoint, you're on your own.

Today we're excited to announce the next step for iTechnology Forms Accelerator: version 2 for Window SharePoint Services 3 and Microsoft Office SharePoint Server 2007.

This new version comes with everything you'd expect to find in a forms engine solution, like web-based designer, strict version control and one-click publishing process. But unlike most forms solutions, iTechnology Forms Accelerator was built based on real-life experiences we had with real clients – it is made for business users and it resolves many issues you may experience with other products.

Here are seven features that are possible because iTechnology Forms Accelerator V2 is tightly integrated with Windows SharePoint Services:

Web-based designer
When you use iTechnology Forms Designer, you browser automatically loads a Silverlight-based component. Using Silverlight 3 features makes designing forms easier. It also allows centralized no hassle deployment.

Version Control
If you work with InfoPath you probably face issues with versioning: InfoPath form templates are not versioned and you have to rely on third-party Source Version Control systems; and once InfoPath form is published to the SharePoint it starts auto-upgrade of existing instances of the electronic forms. With iTechnology Forms Accelerator you don’t have to worry about losing your changes. Each time you make a significant change a new version of the form is saved. You always can go back and load previous version. Also, once you publish your form to the list/document library, it won’t affect already created instances. Think of it as paper-based form with revision number. Just because there is a new revision you do not necessary want to “upgrade” previous filled in forms.

Easy Publishing
iTechnology Forms Accelerator integrates with any type of SharePoint document library or custom list. You start iTechnology Forms Designer from the SharePoint list you want to integrate with. When you think you are ready to publish the form you just click menu button “Publish” and publishing is done automatically. Now you don’t have to remember SharePoint URLs, manage credentials in corporate network, or worry what environment you are working now.

Windows SharePoint Services Support (WSS 3)
For those times when you do not have enterprise licenses of MOSS, iTechnology Forms Accelerator is a great alternative to InfoPath Form Services. iTechnology Forms Accelerator works with Windows SharePoint Services as well as with any MOSS editions.

Concurrent Form Design

Designing large forms with tens of Perspectives (we use term 'Perspective' which is analogous to InfoPath term 'View') can be very time consuming if you work with a form exclusively. iTechnology Forms Accelerator liberates you: now you can share form design time with other users. In contrast to other software products, iTechnology Forms Designer allows “locking” and “versioning” on smaller elements of the form.


Standard Browser Support
If you want to display your electronic forms in browsers such as FireFox, Safari, Chrome, or Internet Explorer, then iTechnology Forms Accelerator is for you. We do not have limitations on displaying web content in different browsers. It works with a simple Text Control as well as with a complex repeatable data grid with subsection.


Easy to Use

The ultimate idea behind iTechnology Forms Accelerator is to empower end-users of SharePoint (both business users and support IT personnel). We see an opportunity and challenge to make process of authoring and managing forms easy and intuitive. Here at iTechnology we spent thousands of hours designing software experiences we feel proud to share with you.

iTechnology Forms Accelerator has many other useful and important features. Here are a few:

  • Management Site. SharePoint administrators have access to many configuration settings which helps administering iTechnology Forms Accelerator in an easy manner. It also provides a comprehensive view of underlying data;
  • Workflow Integration. We integrate with all SharePoint-based workflows;
  • Straightforward data reporting. Non-SharePoint data is stored in SQL database which allows uncomplicated data retrieval and processing;
  • Embedded Rules Editor. Configure business rules instead of coding them. Test Rule allows validation of logic during the design time;
  • and many other great features.


Since there's nothing quite like seeing the product in action, we made this video to demonstrate a simple “Hello World” example:



iTechnology Forms Accelerator is free. There are no paid versions. There are no trial periods. Our clients needed this product and now we share this product with them and with you. We are being constantly asked “What is your business model? Why it is for free?”. We are proud to answer: “We want to help you. At in the same time we want people to know our company.” Please give it a try and see if you and your business will benefit with iTechnology Forms Accelerator. Of course, we provide a commercial support if your company needs it (check Technical Support page for more details).

Check out the iTechnology Forms Accelerator to learn more and browse a gallery of product screenshots.

Thank you and we always welcome comments.



Read more on this article...
Bookmark and Share

Sunday, September 20, 2009

'09 SharePoint Conference in Las Vegas, Oct 19-22

Join us for the greatest SharePoint event this year: 2009 SharePoint Conference in Las Vegas, NV, October 19-22

iTechnology will present an updated version of iTechnology Forms Accelerator. The latest version allows development of electronic forms for Sharepoint (WSS and MOSS) without reliance on Microsoft Infopath or limitations of core Sharepoint technology.

Give your business a chance to adopt Sharepoint faster and easier

For more information, visit the SharePoint Conference site Read more on this article...
Bookmark and Share

Tuesday, July 28, 2009

SharePoint Web Services Wrapper

By Hristo Yankov

Recently I noticed that a common reason for developers to seek help on the MSDN forum is related to difficulties understanding and/or utilizing the SharePoint Web Services. You can't blame the developers. It's much more convenient to work with an Object Oriented API, rather than exchanging XML messages with a Web Service. For example, take a look at the Lists.asmx -> GetListItems. Of course it's no rocket science, but it will sure save time if you could avoid dealing with the XML directly.


I spent some time researching if there is some kind of a library out there which provides 'managed' access to those Web Services. I.e. - work with .NET objects, rather than construct and parse XML elements. The closest thing I have found is this and it's totally outdated and incomplete. At least it's some reassurance to me that I am not missing the big picture and indeed, there might be people who would appreciate such framework.

So, I decided to start a project which will try to implement such .NET Object Oriented API around the SharePoint Web Services. Of course, for those corner weird cases (as well for the advanced developers), the underlying XML will still be accessible. Here is a good description of all the SharePoint services. My goal is to cover them all, eventually. I will start with the most commonly used ones.

It is hosted on CodePlex - http://spwebserviceswrapper.codeplex.com/
The project is not published yet, as there is no single line of code written yet. I will be doing this in my spare time. Once I shape it to my liking, it will become open source and everyone is welcome to contribute.

Got comments? Suggestions/Objections? There is a similar library already implemented? Please do let me know.

Hristo
Read more on this article...
Bookmark and Share

Thursday, July 23, 2009

SharePoint bug udating title of uploaded xml

By Hristo Yankov

Another interesting case...

Programmatically upload an xml file (extension should be .xml) to SharePoint document library. As soon as you upload it, try to change the Title field of the item.


So here is the code:

// We upload the file to SharePoint
SPFile file = Web.Files.Add(itemUrl, buff, true);
Web.Update();

string newTitle = "Sample Title";
SPListItem destItem = file.Item;
destItem.File.CheckOut();
// Try to change the title
destItem["Title"] = newTitle;
destItem.UpdateOverwriteVersion();
destItem.File.CheckIn(string.Empty,
SPCheckinType.MinorCheckIn);


For any non-xml extension files it works, but for xml files the Title doesn't change - it remains the same as the original name of the uploaded file. If you try doing this with another field of the item, it would work.

I came up with the following workaround:

SPFile file = Web.Files.Add(itemUrl, buff, true);
Web.Update();

string newTitle = "Sample Title";
SPListItem destItem = file.Item;
destItem.File.CheckOut();
destItem["Title"] = newTitle;
destItem.UpdateOverwriteVersion();

// Work-around start
destItem["Title"] = newTitle;
destItem.Update();
// Workaround end

destItem.File.CheckIn(string.Empty, SPCheckinType.MinorCheckIn);


Anyone has clue what's going on? Original MSDN forum thread is here.
Read more on this article...
Bookmark and Share

Wednesday, July 22, 2009

Extending SharePoint Web Part

By Hristo Yankov

Hello!

SharePoint provides a lot of different out-of-the-box Web Parts. But sometimes we wish a particular web part behaved in a little different way, or have some small extra functionality. Or we may want to implement a heavily modified Web Part, based on already existing one.

Today, I will show you how to extend the functionality of an already existing web part.


We will take for example the SharePoint RSS Viewer. It loads an RSS feed and visualizes it in a web part on a SharePoint site. One of its visible properties in the UI is the Feed URL. It's a static string and doesn't allow any kind of dynamic parameters. Example:
  • You can write: http://servername/service?Zip=92692
  • But you can't: http://servername/service?Zip=#zip_of_current_location#

Or
  • You can write: http://servername/service?IP=192.168.1.5
  • But you can't: http://servername/service?IP=#current_ip#

Those placeholders in my example are fictional, but you should get the idea of a dynamic value passed as a parameter to the service.

Our goal is to override the default behavior of the Feed URL field. We want to get to a point where we actually control how the Feed URL is being interpreted. We may want to replace placeholders with actual values, or do any other kind of adjustment of the URL, based on current and dynamic conditions. So here is the plan: we create a new web part, inherit the RSS Viewer web part and extend the Feed URL property.

Let's start. Here is how the RSS View part settings look like in edit mode:


See the RSS Feed URL field? That's what we are interested in.

Ok, start Visual Studio 2008 with the VSeWSS plugin installed. From the menu, start a new SharePoint -> Web Part project.


Give it a full trust


Change your namespace to something you prefer (for example, I will change it to HristoYankov). Rename the folder 'WebPart1' to 'RSSAggregatorWebPartDynamicParam'. It will rename all classes and files for you. In the Solution Explorer, expand Properties and open AssemblyInfo.cs. Add this to the bottom:
[assembly: AllowPartiallyTrustedCallers]

and this to the top:
using System.Security;

Your Solution Explorer should look similar to:


Right click on your project, click on Properties, go to the Debug tab and set the SharePoint site URL you will be deploying to.


Open the RSSAggregatorWebPartDynamicParam.webpart file and set Title and Description to whatever you like.

Now, after your project is setup, starts the interesting part. Let's inherit the RSS View control! What you need to do is...

Add this file as a reference - C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\ISAPI\microsoft.sharepoint.portal.dll. This is where the RSS View class is defined.

Open your RSSAggregatorWebPartDynamicParam.cs file and change your class from this:
public class RSSAggregatorWebPartDynamicParam : System.Web.UI.WebControls.WebParts.WebPart

to that:
public class RSSAggregatorWebPartDynamicParam : RSSAggregatorWebPart

And add this statement:
using Microsoft.SharePoint.Portal.WebControls;

Basically, we no longer inherit the basic WebPart class. Instead, we now inherit the whole functionality of the RSS Viewer web part and all of its user interface!

You can also delete this function, as we are not going to do any changes there.
protected override void CreateChildControls()

So far so good. Now let's override the Feed URL property! Add this to your class:

[DefaultValue(""),
Resources("RSSWebpart_Property_FeedUrl_Text",
"RSSWebpart_ToolPart_Group",
"RSSWebpart_Property_FeedUrl_Description"),
Personalizable(PersonalizationScope.Shared),
WebBrowsable(true)]
public new string FeedUrl
{
get
{
return base.FeedUrl;
}
set
{
base.FeedUrl = value;
}
}


And add this statement:
using System.ComponentModel;

Three things to note here:
1. The FeedUrl property is the one which handles the URL which points to the RSS feed.
2. Note the attribute on top of the property. If you don't add it, it won't be visible in the UI
3. Note the 'new' keyword. This way we hide the underlying base FeedUrl property.

Ok, now we have control over the Feed URL. What we should do, is change the way FeedUrl is being returned. Change your get to look like:

get
{
return OverrideURL(base.FeedUrl);
}


And create this function:

private string OverrideURL(string url)
{
// TODO: Process the URL
return url;
}


So, in OverrideURL we can change any way we like the URL that is set in the User Interface and then return it modified. At this point, it is up to you how to utilize this capability.

For the purpose of the example, let's just look for the string #current_date# in the URL and replace it with the current date.

private string OverrideURL(string url)
{
return url.Replace("#current_date#", DateTime.Now.ToShortDateString();
}


At the end, your code should look like:

using System;
using System.Runtime.InteropServices;
using System.Web.UI.WebControls.WebParts;

using Microsoft.SharePoint.WebPartPages;
using Microsoft.SharePoint.Portal.WebControls;
using System.ComponentModel;

namespace HristoYankov
{
[Guid("03badfa9-53e4-401a-bc60-28db88b202ac")]
public class RSSAggregatorWebPartDynamicParam : RSSAggregatorWebPart
{
public RSSAggregatorWebPartDynamicParam()
{
}

[DefaultValue(""), Resources("RSSWebpart_Property_FeedUrl_Text", "RSSWebpart_ToolPart_Group", "RSSWebpart_Property_FeedUrl_Description"), Personalizable(PersonalizationScope.Shared), WebBrowsable(true)]
public new string FeedUrl
{
get
{
return OverrideURL(base.FeedUrl);
}
set
{
base.FeedUrl = value;
}
}

private string OverrideURL(string url)
{
return url.Replace("#current_date#", DateTime.Now.ToShortDateString());
}
}
}

Now, right click your project and do 'Deploy'. It should add a RSSAggregatorWebPartDynamicParam assembly to your GAC. When you go to your SharePoint site and do 'Edit Page' -> 'Add Web Part'

you should be able to see your newly created web part listed in the pop up. Add it to the page. Put it in Edit Settings mode and set the Feed Url to something like:
http://servername/service/Param1=#current_date#

It will be replaced by:
http://servername/service/Param1=06/06/2009 (for example)


NOTE: I just noticed this - as soon as you set the URL which contains the 'placeholder', the web part which is still in edit mode starts showing it with a replaced value (the date). I believe that the underlying value is still http://servername/service/Param1=#current_date#. So perhaps, in the method OverrideURL we should be taking into consideration if the web part is in edit mode. And if it is - just return the original parameter that was passed. Something like:

private string OverrideURL(string url)
{
if (this.NotInEditMode)
{
// Not in edit mode, perform changes
return url.Replace("#current_date#", DateTime.Now.ToShortDateString());
}
else
{
// We are in edit mode, return URL as is
return url;
}
}


I will be checking this later. As usual, you can get the full source code here.

But basically that's it. With minimum amount of code and effort, we have extended the functionality of an already existing web part, to something that serves our concrete needs.

Hope this was helpful!
Read more on this article...
Bookmark and Share

Tuesday, July 21, 2009

SharePoint Solution Hello World Tutorial

By Hristo Yankov

Hi,

In this post, I will explain to you how to create your first SharePoint 2007 ASP.NET application. We will cover what tools you would need and what are the steps to creating a SharePoint Hello World app! I will keep the article short and clear on the necessary steps to be followed.


First, let's start with the tools. You will need Visual Studio 2008 SP1 (preferably) this freely available plugin for it Visual Studio 2008 extensions for Windows SharePoint Services 3.0. It is a toolset for developing custom SharePoint applications: Visual Studio project templates for Web Parts, site definitions, and list definitions; and a stand-alone utility program, the SharePoint Solution Generator.

We assume that you have setup and you do have available a SharePoint site, on which we will be deploying our solution.

So, start your Visual Studio 2008. From the menu choose to start a new Project.


Visual Studio will show this window. Select GAC and proceed.


Your Solution Explorer would look like this, initially:


We need to create a couple of folders. Recreate the folder structure described in the screenshot below:


Right click on HelloSharePointWorld and select add new item. Select text file, but name it "Hello.aspx"


Put the following content in your newly created ASPX page.

<%@ Page Language="c#"
Inherits="Hello, SharePointHelloWorld, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=3cf44204a7ad1f1e"
MasterPageFile="~/_layouts/application.master"
%>

<asp:Content ID="Content1"
ContentPlaceHolderID="PlaceHolderMain"
runat="server">
<asp:Label ID="lblLabel1" runat="server" Text="Hello World!">
</asp:Label>
</asp:Content>

Note the PublicKeyToken value. It will be changed later. Now, create a new class in the App_Code folder. Name it Hello.aspx.cs. Your directory structure should look like:


The content of your Hello.aspx.cs should read:

using System;
using Microsoft.SharePoint.WebControls;

public partial class Hello : LayoutsPageBase
{
protected void Page_Load(object sender, EventArgs e)
{
}
}


Right click on your project, select Properties from the menu. Go to the Debug tab and set the hostname and port number of the SharePoint site where you want your project to be deployed.


Then save.

Now, right click on your project in Solution Explorer and rebuild it. Then right click on it and Deploy.


Now, open Windows Explorer and navigate to C:\WINDOWS\assembly. You should see an assembly called SharePointHelloWorld there. Right click it and select Properties.


Copy the Public Key Token (highlighted, note that it would be different for you) and click Cancel button. Now go back to your ASPX page in the project and replace the incorrect Public Key Token with the one you just copied.

Redeploy your application. Start Internet Explorer and navigate to http://[server name]:[port]/_layouts/HelloSharePointWorld/Hello.aspx

You should see something similar to:


Congratulations, you have created your first SharePoint solution. If you start the Central Admin for SharePoint and go to Operations -> Solution Management you should see a solution named sharepointhelloworld.wsp.

Let's add one more modification. Open the Hello.aspx.cs file and change it to:

using System;
using Microsoft.SharePoint.WebControls;
using System.Web.UI.WebControls;

public partial class Hello : LayoutsPageBase
{
protected Label lblLabel1;

protected void Page_Load(object sender, EventArgs e)
{
lblLabel1.Text = "Hello world! Time is: " +
DateTime.Now.ToString();
}
}



By that, we utilize the code behind to output data on the screen. Rebuild, redeploy and refresh the page.


This is a good starting point for further learning by experimenting and example.

Of course, the full code for this project can be found here.
Read more on this article...
Bookmark and Share