How to use the XmlFormView component displayed Info Path *.xsn file within VisualWebPart - sharepoint-2010

I have followed the instructions described in the Publish a InfoPath 2010 form to Form Library in SharePoint 2010 tutorial and successfully published the InfoPath 2010 form in Form Library in SharePoint 2010.
I want to develop a custom VisualWebPart that uses the XmlFormView component displayed Info Path *.xsn file. I have configured my XmlFormView in the following manner:
<cc1:XmlFormView … XsnLocation="/FormServerTemplates/*.xsn">
</cc1:XmlFormView>
When I embed my custom VisualWebPart onto any page, I encounter the following error:
w3wp.exe (0x1454)
0x1594
InfoPath Forms Services
Runtime
e568
Verbose
Unexpected exception while getting file at:
http://SharePointUrl/FormServerTemplates/*.xsn.
Exception of type:SPException. Message:Cannot open file "FormServerTemplates/*.xsn".be9cb443-292a-4c80-9188-06a01e6393c5

*.xsn will not work, you will have to specify specific infopath form teamplate.

Found a solution in the “Publishing and Deploying Using the InfoPath Wizard -> Publishing Form Templates as a Separate Content Type” article of the “SharePoint 2010 as a Development Platform” book:
In the Publishing wizard you will be asked to specify a location and file name for your form template. You can specify any document library within the site to which your content type will be
published. However, the best location for your form templates is a library called Form Templates within
your site. This library is available in every site and can be accessed by the path /FormServerTemplates.
Specify a location and file name for the form template:
http://SharePointUrl/FormServerTemplates/*.xsn
<cc1:XmlFormView … XsnLocation="/FormServerTemplates/*.xsn">
</cc1:XmlFormView>

Related

Where are SharePoint WebPartPages located?

I'm very new to SharePoint and I am having trouble working out where the various templates and web part pages can be located in SharePoint Designer.
I've found the home page and the master page of the site I'm working on and there are a couple of references to other blocks of code that I can't trace.
For example:
<WebPartPages:WebPartZone runat="server" Title="<%$Resources:cms,WebPartZoneTitle_TopRightColumn%>" ID="TopRightColumn"><ZoneTemplate></ZoneTemplate></WebPartPages:WebPartZone>
Where would I find the file this code references?
There is also code like this
<%# Register TagPrefix="companyName" TagName="CompanyNameFooter" Src="~/_controltemplates/CompanyNameFooter.ascx" %>
This apparently references a file in the directory: C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\TEMPLATE\CONTROLTEMPLATES
How do I access this file from within SharePoint?
You can only access from SharePoint Application, Goto Site contents >> Pages u can see the pages which are available

DNN 7 issue with SupportedModules attribute

I'm an experienced (ASP.NET|Java|PHP|web) developer, new to DotNetNuke.
Currently I'm following a blog tutorial to try to get an Angular module up-and-running in my local installation of DNN 7 (http://www.bitboxx.net/Blog/Post/505/DNN-module-development-with-AngularJS-Part-1#)
My environment: Windows 2012 Server R2, SQL Server 2016 Express, Visual Studio 2015 and DNN 7 on IIS 8.
DNN nuke runs fine.
I installed the downloaded module from the blog to my DNN. I'm having problems to run the HelloWorld example (at the bottom of the 2nd part of the course).
Through some trial-and-error I found out this has to do with the [SupportedModules] attribute on the controller.
Without this attribute it runs fine, but with the attribute it won't.
How does DNN determine the name of the module? The "installation" process was no more then unzipping the modules contents to the DesktopModules directory within my DNN directory (in inetput\wwwroot).
Do I need to install/configure the modules in Settings > Extensions?
Or am I missing some other point with regards to the DNN 7's security?
Thanks in advance for any help/thoughts!
Yes, you need to install the module through the Extensions mechanism in DNN. This will register the module so DNN is aware of the module as well as make sure the files get copied to the right places, in accordance with the installation manifest (the .dnn file you should find inside that .zip file)
However, looking at the blog article you referenced, I don't see an actual installation zip file anywhere. The only download I found was for the project as a whole. You would need to package your compiled solution into an installable zip file (with a .dnn manifest file) or you need to manually register your extension from the Extensions page.
On that page you should click the "Create New Extension" button which will walk you through supplying details for the module. Choose Module as the Extension Type
Only a few of the items are required. The "Name" you use for the module will be the name you use in SupportedModules. It will also default your folder name (the folder in /DesktopModules) to the module name. Friendly Name, incidentally, is what will be displayed in menus and such.
Once you've created the module it should be registered with DNN. You will probably need to restart your AppPool and website for the change to take effect.
FYI, SupportedModules isn't strictly required. If you're building this for a client and not building this for distribution.
Hope this helps.

Cannot access key in resource file from mvc 4 controller

I have a resource file called Constants.resx which contains some strings. From the controller I am trying to access to a new string that I have just added to Constants.resx file but it is not recognized by the compiler (intellisense is not showning me the new string just added) and of course when I type it, an error is shown.
In the controller header I have added below line:
using Resources;
and to access to the new string just added I do the following:
Resources.Constants.NewString
I access to other strings in Constants.resx file using the same approach and no problem, they are recognized correctly, but not this new one.
Any ideas?
UPDATED:
My resource file for my mvc 4 app was added by selecting "Add > new item" from App_GlobalResources context menu and finally selecting "Resource file".
My resource files properties are:
Build action: Content
Copy to Output Directory: Do not copy
Custom Tool: GlobalResourceProxyGenerator
Custom Tool Namespace: (left blank)
Also I am using Visual Studio 2010 Express edition.
I can see the compiler is throwing a warning saying it cannot find the custom Tool 'GlobalResourceProxyGenerator' in the system.
You have to set the namespace of all the resource files as a common namespace like ViewResource. Then change the access modifier in the resource file as public. Now you can access those resource files.
Build action: Content
Copy to Output Directory: Do not copy
Custom Tool: GlobalResourceProxyGenerator
Custom Tool Namespace: ViewResource
Access Modifier : Public (In all resource Files)

How do I publish specific files not in project in VS 2010?

Is there a way I can publish *.ascx files without adding them to my project?
I am trying to make my user controls in Visual Studio 2010 reusable. I have a project containing my user controls called ControlsLibrary solution directory. I copy the ascx files to the web directory upon building the project with build events.
I use the command copy "$(SolutionDir)ControlLibrary\*.ascx" "$(ProjectDir)controls\"
This copies the *.ascx files from G:/SolutionDirectory/ControlsLibrary to C:/Inetpub/wwwroot/WebProject/controls
Now when I publish WebProject, the publish does not copy the *.ascx files from C:/Inetpub/wwwroot/WebProject/controls to my website. This is because they are not added to my project.
Is there a way I can publish *.ascx files without adding them to my project?
I know there is a way to publish all files by selecting the option "All files in this project." That includes more files than I want.
Have you considered using the Virtual Path Provider approach? Here's a good article on it: Load Web Forms and User Controls from Embedded Resources.

ASP.NET Server Control - How to add AssemblyInfo file

I've noticed on a few tutorials online that when a new ASP.NET Server Control is added, it automatically includes Properties folder (containing AssemblyInfo.cs) and a References folder.
This works fine for me when creating a C# Server Control, but in VB.NET I just get a template .vb file and a Project file.
Why is this and how can I get an AssemblyInfo.vb file?
AssemblyInfo.vb file is created for every project. By default it is not displayed in the Solution/Project Explorer.
To view this file and others in Visual Studio click Project >> Show All Files menu items.