How to REpublish Custom Task Forms (InfoPath) to SharePoint 2010 State Machine Workflows - sharepoint

I am new to SharePoint. Sorry if answer to my question is obvious.
I've create Custom Task Form in InfoPath and publish it (File/Publish/Network Location [Form Template Path and filename='MYPROJECT/Forms/ApprovalForm.xsn'; Form template name='ApprovalForm'], in the next window I've cleared Public URL according to the article http://www.codeproject.com/Articles/195348/SharePoint-2010-State-Machine-Workflows-with-Custo).
After it I've added module Forms, and added ApprovalForm.xsn from the existing items.
My xml files:
Elements.xml
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<Workflow
Name="Order New Server"
Description="My SharePoint Workflow"
Id="482cbc86-b717-4981-a49a-3cf4c89e9399"
CodeBesideClass="Myproj.OrderNewServer.OrderNewServer"
CodeBesideAssembly="$assemblyname$"
TaskListContentTypeId="0x01080100C9C9515DE4E24001905074F980F93160">
<Categories/>
<AssociationData><Data></Data></AssociationData>
<MetaData>
<AssociationCategories>List</AssociationCategories>
<Task2_FormURN>urn:schemas-microsoft-com:office:infopath:ApprovalForm:-myXSD-2012-03-09T14-11-55</Task2_FormURN>
<StatusPageUrl>_layouts/WrkStat.aspx</StatusPageUrl>
</MetaData>
</Workflow>
</Elements>
Feature.Template.xml:
<?xml version="1.0" encoding="utf-8" ?>
<Feature xmlns="http://schemas.microsoft.com/sharepoint/" ReceiverAssembly="Microsoft.Office.Workflow.Feature, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" Receiverlass="Microsoft.Office.Workflow.Feature.WorkflowFeatureReceiver">
<Properties>
<Property Key="GloballyAvailable" Value="true" />
<Property Key="RegisterForms" Value="Forms\*.xsn"/>
</Properties>
</Feature>
My form work fine, but when I make changes and republish it, it doesn't update (I see old form).
What I tryed:
IISReset
Clear all cookies and cache in IE
Retract solution, restart VS2010, reboot computer.
Change assembly number, guid.
I have no ideas, what can I try for republish my form with changes.
Thank you in advance for any suggestions.
PS: sorry for my writing. English is not my native language.
PPS: when I save new Form to new location and add it to the project, it works.

I've found how can I republish changes. But it seems more like crutch than solution, but it works: After republishing InfoPath form, I delete file from project (DEL on ApprovalForm.xsn in Solution explorer) and after it add it again. (Add/Existing Item). And then redeploy! Hurray!

Related

SharePoint hosted app custom list form upgrade

I created a SharePoint Hosted add-in with custom list form as directed in
https://blogs.msdn.microsoft.com/wilsonreddygajarla/2014/12/13/sharepoint-list-newform-customization-in-sharepoint-hosted-app/
All, works great until you want to upgrade the add-in with changes to your custom form. I have tried the following approaches:
Created a module entry within the list element.xml with ReplaceContent=True which deploys successfully but does not replace the form with new changes.
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<Module Name="CustomList">
<File Url="NewItem.aspx" Path="CustomList/NewItem.aspx" ReplaceContent="TRUE" />
</Module>
<!-- Do not change the value of the Name attribute below. If it does not match the folder name of the List project item, an error will occur when the project is run. -->
<ListTemplate ...`
Tried to reference a custom form page from Pages module but the Path in Schema.xml somehow keeps looking for the custom form within the List Definition folder.

WSS 3.0 ItemAdded

I am working with WSS 3.0 and trying to set some permissions with the ItemAdded-Event.
The problem is, that the event dont fire if I add an item. I've searched the whole web and found nothing. It is only on ItemAdding / ItemAdded, yet I have already implemented a ItemUpdating and ItemDeleting Event which are working perfect! Are there known issues?
This is my Event (It not even get my debugmessages.. :( ):
public override void ItemAdded(SPItemEventProperties properties)
{
Debug.WriteLine("ItemAdded started.");
PMDB_ContentType_Class pmClass = new PMDB_ContentType_Class();
pmClass.SetPermissions(properties);
Debug.WriteLine("ItemAdded ended.");
}
This is the feature.xml
<?xml version="1.0" encoding="utf-8"?>
<Feature Id="34e2c6bd-0e9f-4a65-b280-3cd4c5ff5cb4" Title="PMDB_ContentType"
Scope="Site" Version="1.0.0.0" Hidden="FALSE" DefaultResourceFile="core"
xmlns="http://schemas.microsoft.com/sharepoint/">
<ElementManifests>
<ElementManifest Location="PMDB_ContentType\PMDB_ContentType.xml" />
</ElementManifests>
</Feature>
1 >> I hope that you have attached you event with your list properly in FeatureActivated Event receiver of Feature. I cannot check that because you haven't post that code. please check if there are any errors in that code.
2 >> Use Sharepoint Manager (http://spm.codeplex.com/releases/view/51438) to see if your event is properly attached to your list or not. if not then try to deactivate feature from web UI and reactivate it again.

Using the default approval workflow task form in a custom Visual Studio Workflow

I am making a custom approval workflow in VS, but I dont wan to create a custom infoPah form to create the task edit form. Is there any way to use the form that comes with the OOTB approval workflow??
Thanks
You should try to specify the URN of OOTB InfoPath form in Elements.xml of your workflow solution.
Example:
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<Workflow
Name="WorkflowProject1 - Workflow1"
Description="My SharePoint Workflow"
Id="1ac59aff-6d65-4e7c-9dc1-e84e7cbc6b3a"
CodeBesideClass="WorkflowProject1.Workflow1.Workflow1"
CodeBesideAssembly="$assemblyname$">
<Categories/>
<MetaData>
<AssociationCategories>List</AssociationCategories>
<!-- Tags to specify InfoPath forms for the workflow; delete tags for forms that you do not have -->
<!--<Association_FormURN>[URN FOR ASSOCIATION FORM]</Association_FormURN>
<Instantiation_FormURN>[URN FOR INSTANTIATION FORM]</Instantiation_FormURN>
--><Task0_FormURN>urn:schemas-microsoft-com:office:infopath:workflowInitAssoc:-AutoGen-2009-07-30T07:17:57:12Z:1033</Task0_FormURN><!--
<Task1_FormURN>[URN FOR TASK (type 0) FORM]</Task1_FormURN>-->
<!-- Modification forms: create a unique guid for each modification form -->
<!--<Modification_[UNIQUE GUID]_FormURN>[URN FOR MODIFICATION FORM]</Modification_[UNIQUE GUID]_FormURN>
<Modification_[UNIQUE GUID]_Name>[NAME OF MODIFICATION TO BE DISPLAYED AS A LINK ON WORKFLOW STATUS PAGE</Modification_[UNIQUE GUID]_Name>
-->
<StatusPageUrl>_layouts/WrkStat.aspx</StatusPageUrl>
</MetaData>
</Workflow>
</Elements>
You can check installed InfoPath Templates in Central Administration > General Application Settings > Manage Form Templates > when you click on template you could see the form URN.
Hope it helps.

I've got a sharepoint solution, what next

I'm new to sharepoint. I have a C# solution, that has masterpages and user-controls to be used in a sharepoint site. I have setup my sharepoint dev VM and i can browse the default sharepoint stuff.
How do I add the master pages to Sharepoint? Where do I go from here?
My suggestion would be to deploy the master pages as a feature rather than a manual process. Solutions (WSPs) and Features are the supported way to deploy content/features into sharepoint. A really great tool for sharepoint development is called WSPBuilder
A master page is deployed into sharepoint as a "module" that you will place into your elements.xml file in the feature.
Think of a solution as a .cab file with a different extension. Within that is a file called feature.xml which defines the title of your package when its deployed. Features can be activated and deactivated to deploy and undeploy your content into parts of your farm.
Here is an example of a css file deployed as a Module... Master pages would be similar however, they would deploy into the master page gallery rather than the style library. This module deploys a custom css file into the "Style Library" of a site collection. After this is deployed I used a "Feature Receiver" (event handler) to grab a reference to the SPSite object and modify its alternate stylesheet so that my override took place.
Feature.xml
<?xml version="1.0" encoding="utf-8" ?>
<Feature xmlns="http://schemas.microsoft.com/sharepoint/"
Id="63BB13A0-1F9C-4c3b-BE60-10E59CEE0113"
Title="Custom CSS Feature"
Description="Deploying a custom CSS using a feature"
Version="1.0.0.0"
Hidden="FALSE"
Scope="Site"
ReceiverAssembly="CustomCSSFeature, Version=1.0.0.0, Culture=neutral, PublicKeyToken=24f1377a8414d2ed"
ReceiverClass="CustomCSSFeature.FeatureReceivers.CustomCSSFeatureReceiver"
>
<ElementManifests>
<ElementManifest Location="elements.xml"/>
</ElementManifests>
</Feature>
elements.xml - you'd modify this to reflect where master pages are supposed to be deployed I would think that this is the Url property. The Path="Styles" refers to the relative path within the feature itself where the style sheet resides (e.g. in your visual studio i have a sub folder called styles beneath the folder called CustomCSSFeature and that is where the style sheet exists)
<?xml version="1.0" encoding="utf-8" ?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<Module Name="OSGStyles" Url="Style Library" Path="Styles" RootWebOnly="TRUE">
<File Url="custom-css.css" Type="GhostableInLibrary" />
</Module>
</Elements>
Then, in my feature receiver class I have activated/deactivated handlers which "apply" the stylesheet to the publishing web. In your case you can likely change the default master page for the website in a feature receiver as well.
public override void FeatureActivated(SPFeatureReceiverProperties properties)
{
SPSite site = properties.Feature.Parent as SPSite;
using (SPWeb web = site.OpenWeb())
{
PublishingWeb publishingWeb = PublishingWeb.GetPublishingWeb(web);
publishingWeb.AlternateCssUrl.SetValue(web.ServerRelativeUrl +
"/Style Library/custom-css.css", true);
publishingWeb.Update();
web.Update();
}
}
public override void FeatureDeactivating(SPFeatureReceiverProperties properties)
{
SPSite site = properties.Feature.Parent as SPSite;
using (SPWeb web = site.OpenWeb())
{
PublishingWeb publishingWeb = PublishingWeb.GetPublishingWeb(web);
publishingWeb.AlternateCssUrl.SetValue("", true);
publishingWeb.Update();
web.Update();
}
}
Copy them to SharePoint root (For SP 2007 default location is C:\Program Files\Common Files\microsoft shared\Web Server Extensions\12\, for SP 2010 instead of "12" you have "SharePointRoot")
From there, copy your files to \TEMPLATE\LAYOUTS folder and then you can reference masterpage from your aspx pages like "/_layouts/mymasterpage.master".
UserControls goes into \TEMPLATE\CONTROLTEMPLATES
Get to know the directory structure in the 12 Hive
Exploring the 12 Hive : TEMPLATE Directory
Another way is to put your masterpage in master pages list. Use this link to access master page list and upload your masterpage: http:///_catalogs/masterpage
You can add master pages using the SharePoint Designer 2007.
Generally i recommend you to take a look at the answers of this question: Learning Sharepoint

WSS 3.0 Site Definition breaks when including MasterUrl in onet.xml

I have created a simple site definition for WSS 3.0 which uses a feature, this feature provisions a master page into the masterpage gallery.
This works absolutely fine, and once I've created a site from the definition I can go into the masterpage gallery and view my provisioned file.
If, however, I set the MasterUrl in my Configuration node of onet.xml and then create a new site from it, it fails. After clicking create it redirects me to the new site automatically but presents me with a file not found error. So I type in the url to the settings page and click to view the masterpage gallery which then gives me a file not found error again.
I'm not sure what's going on, but it looks to me like setting the MasterUrl prevents it from creating the correct lists to which the feature can provision the masterpage to. Can anyone shed any light on this matter for me please?
Here is the webtemp*.xml:
<?xml version="1.0" encoding="utf-8"?>
<Templates>
<Template Name="MasterPageTest" ID="10902">
<Configuration ID="0"
Title="MasterPageTest"
Description="Testing master page deployment"
Hidden="FALSE"
ImageUrl="/_layouts/images/stsprev.png"
DisplayCategory="Test"
/>
</Template>
</Templates>
And the onet.xml (with the masterurl attribute removed):
<?xml version="1.0"?>
<Project Title="MasterPageTest" Revision="3" ListDir="$Resources:core,lists_Folder;" xmlns:ows="Microsoft SharePoint" xmlns="http://schemas.microsoft.com/sharepoint/">
<!-- _locID#Title="camlidonet1" _locComment="{StringCategory=HTX}" -->
<NavBars>
</NavBars>
<ListTemplates>
</ListTemplates>
<DocumentTemplates>
</DocumentTemplates>
<Configurations>
<Configuration ID="0"
Description="Testing master page deployment"
Title="Master Page Test"
Name="MasterPageTest"
>
<!-- MasterUrl="_catalogs/masterpage/MasterPage.master" -->
<Lists>
</Lists>
<Modules>
</Modules>
<SiteFeatures>
</SiteFeatures>
<WebFeatures>
<!-- Masterpage -->
<Feature ID="8175B375-38F5-44E2-950A-9600D5427E17"/>
</WebFeatures>
</Configuration>
</Configurations>
<Modules>
</Modules>
<ServerEmailFooter>$Resources:ServerEmailFooter;</ServerEmailFooter>
</Project>
My first thought was: Why in the onet.xml?
I usually do this using a process called Feature stapling. It is impossible to remove / disable functionality created from a site definition later on (off course you could by hand, or a feature + receiver to remove say a list you don't need for a particular site created from the onet.xml, but you probably get the point).
By using feature stapling, (your / the) site definition stays clean and stays what it is meant to be: a definition of a site, that can be selected during site creation. IMHO, it should be nothing more than an empty container.
Feature Stapling binds features you want activated when a site is created to a (custom) siteTEMPLATE. You can even use this to attach features you want activated on out of the box site definitions as well. For instance, feature stapling is the preferred way of enabling features in the "MySite" and "My Site Host" definitions. The original sitedefintion remains untouched, but your features are activated too!
Now to actually answer your question: The masterpage is probably not available yet when the site definition is used, the onet.xml is processed before any features are activated.
If your site is a publishing site (meaning the publishing related features are activated in the site collection), you can set the masterpage in the Publishing Feature with the ChromeMasterUrl property.
If the site is a regular site, you can do 2 things:
deploy the master page from the onet.xml by moving the <Module> from your masterpage feature to the onet.xml, more info here (figure 1).
don't set the masterpage url in the onet, but use a feature + featurereceiver to set the masterpage url, more info here (downloadable code in article).

Resources