Sunday, November 8, 2009

How to: Creating Infopath forms as content types and publish forms in SharePoint

Hi all,

InfoPath 2007 (electronic forms) and SharePoint 2007 fit together very well. However, developing an effective electronic forms solution has been quite challenging.

Issues with InfoPath 2003:

a) Difficult to develop data-driven solutions as the data was not sync with the data in the form.
b) Not easily published without changing the original form designer.

InfoPath 2007 overcame these issues:

a) Form templates can now be attached to content types and thereby we have power to redeploy the templates.
b) Form data fields are bidirectional and therefore developers can promote selected fields and have those fields presented as form library that end users can edit.

In this post, I will talk about a site collection, and few site.

Site-collection: http://comanyname/asia
Under this site collection I have to 2 sub-sites which are on the same level:

Site1: http://comanyname/asia/it
Site2: http://comanyname/asia/tools

Under site1, I also have a sub-site called as it/ITDocCenter where all IT documents are stored as templates (InfoPath templates).

http://comanyname/asia/it/ITDocCenter (sub-site of Site1)

I also have a Site2 (tools), where all IT department people will be filling out the InfoPath forms and these forms are based on templates which are stored in ITDocCenter.

Therefore, I needed content types in "tools" and refer these templates on "tools" sub-site.
I will step-by-step procedures:


1. We first design on InfoPath 2007 templates on local computer. Right click on InfoPath template and open the InfoPath template. On the toolbar, go to Tools >> Submit Options













2. On the "Submit Options" prompt,
>>Check the "Allow users to submit this form"
>>Select the "Send from data to a single destination"
>>From the drop down choose "SharePoint document library"
>> Click on "Add" button.

What we are doing here is that we are selecting a document library (System Checklists InfoPath) which will be on the "tools" sub-site. So, anyone you want to fill out an InfoPath form will be submitting that form to the "System Checklists InfoPath" document library.

















3. On next screen, we define the full URL of that document library. (System Checklists InfoPath).

For the file name, I have used a formula which as some predefined conditions with today's date.














4. Final screen will give a summary of what we have selected. Click on OK button.


















5. Go to "Design Tasks" >> "Design Checker" >> and check the "Design a form template that can be opened in a browser or InfoPath". Save the template now.

















6. Go to "Design tasks" >> "Publish Form Template" >> Choose the first option.














In next screen, we have to enter the SharePoint site and in this case it will be http://comanyname/asia/tools














7. On this screen we will create a new content type. Select the "Create a new content type" and click "Next" button.















8. Type in the name of the content type.















9. This screen prompt us about where we want locate and save the form template. Clearly, we want store all our templates on the ITDocCenter site. In this case, I have stored into "Operations" document library.

http://vm1f2909/sites/asia/it/TeamSites/RegInfra/Forms/Backup.xsn
















10. Promote the selected fields. In my case, I chose "Time Period" and "Templates".



















11. Next screen, will give is the summary and success of the content types.















12. Now, we go to the Tools site and go to "System Checklists InfoPath" document library.
Settings >> Form Settings >> Advanced Settings >> Allow content types.







13. Settings >> Content types >> Add from existing site content types >> Select with content types from >> Microsoft Office InfoPath >> Choose "Backup"













14. In the "System Checklists InfoPath" document library, we can see "Backup" as a new content type.














15. We fill-in the form









16. When we are done we submit the data to "System Checklists InfoPath" document library.





17. We can see a new record in "System Checklist InfoPath" document library. So, Tools >> "System Checklists InfoPath" everything is working fine. Lets check asia/it/ITDocCenter.




18. Surprisingly, there is no template on this document library. Reason: We have chosen "Document Library(Word Documents)" (Template ID : 101) where as "XML Form Library (InfoPath) (Template ID: 115). But we have a workaround.






19. We upload "Backup.xsn" from local computer to the SharePoint Server.






20. Now, we can see the a new record on the "Regional Infrastructure" document library. Now, if site administrator want to modify "Backup.xsn" file which is there in "Regional Infrastructure" document library, he could edit the InfoPath form >> Tools >> Design the form.












21. Add new questions and save it.












22. He has to republish the form template, promote the selected columns.



















23. Finally, modifed InfoPath template has been changed.










24. Now, if we go to "Tools" subsite >> go to "System Checklists InfoPath" >> New >> Backup, then we can see the new questions in InfoPath form.








Cheers,
--aaroh

Wednesday, November 4, 2009

Provisioning failed: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)".

Hi all,

While working on the Shared Services Providers (SSPs), I got an error as follows:
Provisioning failed: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)".

After a while I checked SharePoint's Central Administration and SharePoint Service account (such as systemadmin). Then checked the SharePoint Services (Services.msc) and found that
"Windows SharePoint Services Search" and "Windows SharePoint Services Timer" are using "Local System"

I followed these steps then:

>> Start >> run >> services.msc >> locate the “Windows SharePoint Services Search” and “Windows SharePoint Services Timer”. It should be log on as “Local System”. Right click on the “Windows SharePoint Services Search” >> Properties >> choose “This Account” and will in the SharePoint Service Account. Username: systemadmin, Password: test123.

Do the same steps with “Windows SharePoint Services Timer”.
It will fix the issue.

Cheers,
--aaroh

Monday, November 2, 2009

How to: Converting Word files into Infopath, manipulate InfoPath forms and publish onto SharePoint

Hi all,

In this post, I will talk about converting word files into InfoPath forms, we will manipulate InfoPath forms with some kind of simple logic, and finally publish this forms onto SharePoint.

Lets get started:

1) Open InfoPath 2007 >> Choose the "Design the form template" >>
Select Blank >> Click OK














2) Go to File >> Import form as follows:



















3) Choose word document.












4) The import wizard will convert word document to the InfoPath form.













5) Now, we are done with conversion. We need some kind of logic for the InfoPath form. For my case, I need to have a some questions to be displayed on regular intervals such as Daily, Weekly, Monthly, Quarterly and Yearly. I also have to the template name for a InfoPath forms.

Go to Design Tasks >> Controls >> Drag Drop "Drop-Down List Box" on the form. Then add the list box entries manually.




















5.1) Click on "Rules" button on the drop down list.



















5.2) Click on Add Action Button. Under the Action drop down choose >> "Submit using a data connection"











5.3) It will open a wizard. Choose. "Create a new connection to" >> "Submit data"







5.4) Then Select a destination for submitting your data >> Choose "To the hosting environment, such as an ASP.NET page or a hosting application "









5.5) Choose the default settings and click OK.







5.6) We drag one more control and this time it will be a textbox control.
>> Label will be: Template Category.
Right click on the textbox properties.
>> Field name: will be "templateCat" or simply "template"
>> Value: Backup
>> Under Display tab, make it "Read only".


















5.7) Click on Rules button >> Add >> Add Action. The Data Connection is already set.
Just Click OK. We have defined the rule on the second text box control.



















6) We have 5 tables for each period namely: Daily, Weekly, Monthly, Quarterly, Yearly.
Under Controls, drag-drop 5 sections and copy each table (Daily, Weekly, Monthly etc. tables) to corresponding tables as follows:



















7) Right click on Section (for Daily), Select Conditional formatting, timePeriod is shown up, choose "is not equal to", Select text and type in Daily.
Check the "Hide this control".

Do the same steps for other sections.









8) On Design Task >> Select the "Design Checker" >> Click on "Change Compatibilty Settings" >> Under "Browser compatibility" check the first option "Design a form template that can be opened in a browser or InfoPath" .

9) Save the InfoPath Form and Preview this form. Check if drop down is working for different time periods.








10) On Design Task >> Click on "Publish the InfoPath form". Choose the first option.
"To a SharePoint server with or without InfoPath Forms Services"
















11) We need to enter this Site URL where we have to publish the InfoPath forms.
















12) Create a Site Content Type.






























13) Browse >> Choose the Library where we can to publish InfoPath forms and type in the name of the InfoPath form.













14) On this screen we can promote the columns and these columns (metadata) will be visible on the SharePoint site columns.













Add >> Time Period.














We will add one more column "Template".


15) Next screen will verify if form information is correct. If everything is correct, we just Publish the form and close it.













16) Form library "System Checklists InfoPath", we enable allow management of the content types >> Add existing content types >> "Storage" content type.













17) For the "System Checklists InfoPath" form libray, We can see a New content type >> Storage.













18) When we fill out the "Storage", a drop down list will prompt the user to select a time period. For an instance we chose Monthly and Save the form.


















20) When the from is Saved, the list will show the monthly period as shown:





Cheers,
--aaroh

Thursday, October 29, 2009

SharePoint 2010 New Features

Since the announcing of SharePoint 2010, SharePoint community has been buzzing with speculations on what the new version might offer. Here are the latest updates on SharePoint 2010 new features:

Overview

New User Interface including new Ribbon
Office 2007 style ribbon interface

Web Edit
Allows users to easily customize a site

Silverlight Web Part
Easy Silverlight solutions into SharePoint

Rich Theming
Few office-style themes, just like in Word and PowerPoint.

Multiple Browser Support
IE 7-8, Firefox and Safari. No news about Chrome and Opera

Visio Services
Lets you share data linked diagrams in real time

SharePoint Designer
Comes with a new UI, improved workflow and improved collaboration between designers

Business Connectivity Services (the evolution of the Business Data Catalog)
SharePoint Workspace
Incorporate offline-online synchronizations

Rich Media Support
No matter what type of rich media you’re using, SharePoint 2010 will make your life easier

IT Professional

Streamlined Central Administration
Way better organized Central Administration site

SharePoint Best Practices Analyzer
Farm health monitoring at its best with “Problems and Solutions” page

Usage Reporting and Logging
Consolidated logging and usage reporting capabilities

Large List Resource Throttling
Performance management of big lists of thousands and millions of items

Unattached Content Database Recovery
Allows temporary use of content databases, useful for recovery and restore purposes

Visual Upgrade
Easy migration from 2007 to 2010 while retaining the 2007 themes and UI

Developer

- Visual Studio 2010 SharePoint Tools
- Language Integrated (LINQ) for SharePoint
- Developer Dashboard
- Business Connectivity Services
- Client Object Model (OM)
- Silverlight Web Part

Courtesy: topsharepoint.com

Cheers,
--aaroh




How ASP.NET Developers can leverage SharePoint

Hi all,

While browsing something with respect to SharePoint and relation to ASP.NET.
I found a fantastic presentation from one of SharePoint MVP Jeremy (of SPSource fame - Reverse engineering tool for SharePoint) and brilliant comparison of ASP.NET against SharePoint.

This is the link: How ASP.NET Developers can leverage SharePoint.
And here is the full comparison.

Cheers,
--aaroh

Wednesday, October 28, 2009

Using Feature Properties and its benefits

Hi all,

While working for one of my project, I have to use feature properties. Let me introduce why we need "Feature Properties"

Q. What is exactly is a "Feature property" and why its useful?
Ans. Well, we know that feaure.xml file has certain elements as follows:

i) ActivationDependencies
ii) ElementManifests
iii)Properties

Each element has different use. For e.g.

i) ActivationDependencies is to indicate prevents the current Feature from being activated unless the Feature with the specified ID is activated.

For instance,
<Activationdependencies>
        <activationdependency featureid="11111111-1111-1111-1111-111111111111">
<ActivationDependencies>

ii) ElementManifests contains references to element manifests and element files that contain definitions for the Feature elements.

iii) Properties contains a list of the default values for Feature properties.

<Properties>
<Property
Key="Color"
Value="Blue"/>
<Property
Key="Shape"
Value="Triangle"/>
</Properties>

Benefits of feature properties:

1) Use of default values for storing the data.
Feature framework uses feature properties for storing the data values and its similar functionality of ASP.NET where web.config stores all data connections, global settings and default values.

In SharePoint, we can have exactly same functionality. For e.g.
We can develop a timer job to configuration settings

<Feature xmlns="http://schemas.microsoft.com/sharepoint/"...>
<Properties xmlns="http://schemas.microsoft.com/sharepoint/">
<!-- The name of the timer job (will appear in Central Admin >> ). -->
<Property Key="JobTitle" Value="Aroh's Timer Job"/>
<!-- Connection String that the TimerJob will use -->
<Property Key="ConnString" Value="ConnectionString..."/>
<!-- The schedule to run the job in (24 hour format) -->
<Property Key="Schedule" Value="daily at 02:00:00"/>
</Properties>
</Feature>


We have write a method to tap FeatureActivated method:

public override void FeatureActivated(SPFeatureReceiverProperties properties)
{
// Get all the properties from the feature.xml file
string jobTitle = properties.Feature.Properties["JobTitle"].Value;
string connString = properties.Feature.Properties["ConnString"].Value;
string dailySchedule = properties.Feature.Properties["Schedule"].Value;

// Create the job.
CustomTimerJob customTimerJob = new CustomTimerJob((SPWebApplication)properties.Feature.Parent, jobTitle);

// Set the properties for the job to run properly
customTimerJob.Properties.Add("ConnString", connString);
customTimerJob.Properties.Add("Schedule", dailySchedule);

// Set the schedule
SPSchedule mainSchedule = SPSchedule.FromString(dailySchedule);
customTimerJob.Schedule = mainSchedule;

// Activate the schedule
customTimerJob.Update();
}

Later on, we use timer's job "Execute" method to use feature properties

public override void Execute(Guid targetInstanceId)
{
// Set up configuration values
string connString = this.Properties["ConnString"] as string;
...
}

Another example is where we fixed URLs have to be used.
For e.g. We have a URL:
http://testserver/apac/tools

Now, we can use it in a feature properties as follows:

<Feature Id="40fefb9d-c00a-48fc-b5c8-98ed0263eb0f"
Title="[IT] Alert Notification Job"
Description="Description for AlertNotificationInstaller"
Version="12.0.0.0"
Hidden="FALSE"
Scope="WebApplication"
DefaultResourceFile="core"
ReceiverAssembly="Company.SystemChecklists, Version=1.0.0.0, Culture=neutral, PublicKeyToken=fbfd703f61794815"
ReceiverClass="Company.SystemChecklists.AlertNotificationInstaller"
xmlns="http://schemas.microsoft.com/sharepoint/">
<Properties>
<Property Key ="ApacSite" Value="apac"/>
<Property Key ="ToolsSite" Value="Tools"/>
</Properties>
<ElementManifests>
<ElementManifest Location="elements.xml"/>
</ElementManifests>
</Feature>

And in the execute method (of timer job) we can use feature properties:

public override void Execute(Guid contentDbId)
{
siteName = this.Properties["ApacSite"].ToString();
webName = this.Properties["ToolsSite"].ToString();

// get a reference to the current web application
SPWebApplication webApplication = this.Parent as SPWebApplication;

// get a reference to the Site Collection in the content database
using (SPSite spSite = contentDb.Sites[siteName])
{
// get a reference to the Web
using (SPWeb spWebRoot = spSite.OpenWeb(this.Properties["ToolsSite"].ToString()))
{
// TIMER JOB LOGIC
}
}
}

2) Another use of feature properties is that XML files is not complied.
Therefore, if can to alter the URL from http://testserver/apac/tools to http://testserver/apac/IT/tools, it can be very easily changed in the feature properties itself and just upgrade the solution.

There is NO need to alter the DLL again.

Some important points to be noted:

>> If you want the timer job on Web scope instead on Web Application scope, first DEACTIVATE the feature
>> Alter feature.xml
>> ACTIVATE the feature.

If you don't deactivate the feature and directly change the feature.xml, then your timer job and your SharePoint instance will be screwed up. Solution is there in my post as well.

Cheers,
--aaroh

Low Code Reimagined with AI + Copilot Pitch Deck - Copy Copilot day (Virtual) - 2023

 Hi All,  I presneded a session at Pune UG on Low Code Reimagined with AI + Copilot Pitch Deck.  Video is at this address  https://www.youtu...