Launch Infopath form with parameter - ms-office

Opening an Infopath form with parameter can be done like this:
System.Diagnostics.Process.Start(PathToInfopath + "infopath.exe", "Template.xsn /InputParameters Id=123");
But that requires I know the path to Infopath.exe which changes with each version of Office. Is there a way to simply launch the template and pass a parameter? Or is there a standard way to find where Infopath.exe resides?

Play around with System.Diagnostics.ProcessStartInfo which allows you to specify a file you wish to open and also allows you to specify arguments.
You can then use Process.Start(ProcessStartInfo) to kick off the process. The framework will determine which application to run based on the file specified in the ProcessStartInfo.
I don't have Infopath installed so I unfortunately can't try it out. But hopefully it helps you out a little.

Here's an article about finding the install path for Office Apps:
http://support.microsoft.com/kb/234788

Try using browser based form and querystring instead

Related

Add page break in excel with the module ImportExcel (Powershell)

I'm actually trying to generate a large report with multiple groups in powershell. I want to seperate each groups of data in a single page, but I'm struggling to find the method to add a horizontal page break with the ImportExcel module.
I'm starting to wonder if it is doable. I know that it is possible with the excel interlop com object, but the script with be run with an elevated user right on a server, so we do not want to install excel on to.
So far I've look at the module methods and I did not find anything. It seems like we have access to the document/sheets xml so if someone knows how to do it in xml, it could also do the trick.
I'll post my answer since I found it. The module ImportExcel is based on the EPPLUS library for c#.
I've take a look in the library and there is a way to add a break line fairy easly, but does not show in powershell.
$Sheet.Row($line).PageBreak = $true
It's that simple. There is just not obvious documentation and the intellisense was not finding it too.

Can I write to a text file from a button in xPages?

I have an xPages application that needs to write a text file to a folder on my network. I'm not sure if it's even possible from an xPages application?
If it is, can someone give me an idea how to go about this?
POI4XPages can write views etc to CSV files https://poi4xpages.openntf.org/. I've previously used OpenCSV, and Apache-licensed Java library to import from a CSV file, but it also allows exporting. I use it regularly to preload data for session databases like for my session at Connect 2016. CommonsCSV has subsequently been released, which would replace OpenCSV.
Yes you can. The easiest way is to create a Java class that does what you need (and test it from the command line). In a button, which is server side JavaScript, you can instantiate that class and write out.
You might need to handle security setting (e.g. deploying your class in a jar file into [DominoAppDir]/jvm/lib/ext) to be allowed to have network access. If you rather keep the class in the nsf, you might need harder measures.
Let us know how it goes
I just created a simple class that created the file and wrote to it. Worked like a champ
Thanks all!

Anybody has any ideas what exactly spWeb.Features.Add does?

anybody know what exactly below code does?
SPWeb.Features.Add(Guid, bool)
Does it use the .xmls in Template\Features\<-myFeature-> to install the feature and activate it? Or just activate it? Or something else?
Thanks!
The method you specified activates feature with specified id on specified SPWeb object. It does not install it. Here is MSDN link.
It actually uses xml files in "Template\Features\<-myFeature->" folder when you activate feature.
But if you change file in this folder you won't see any effect momentary because this files are cached. After changing files in feature folder you need to do iisreset and then activate feature in order to see the difference.

Download a document from SharePoint with version number

I need to be able to download a file out of SharePoint (to send externally) that has the version number in the file name.
Is there any way to do this without custom code? If not, how would I code this?
File in SharePoint -> Specifications.doc
Downloaded file -> Specifications V99.doc
I use SharePoint 2007, but I am also interested in a 2010 solution.
Don't think it's possible out of the box. As for manual implementation I see two ways:
1) If you can use some external application (or, for example, webpart or page) to do that, just get sharepoint file as binary stream and save it with the name you want.
2) If you need it to look like standard downloading, add a new custom button to document context menu (Ribbon in SP2010) and again do whatever you want with that document when user clicks the button.
This is about as close as I think we can come at this time:
http://spversionindocs.codeplex.com/
It allows you to have a version number field in your document that is automatically updated with the version number from sharepoint.

Can I use RegFree Com with an application written in Excel VBA?

I have an application that is written in Excel VBA, myApp.xls. Currently we use InstallShield to distribute the application. Since we are moving to Windows Vista, I need to be able to install the application as a standard user. This does not allow for me to update the registry during the install process. In addition to the excel application we also have several VB6 applications. In order to install those applications, I was able to use RegFree com and Make My Manifest (MMM) as suggested by people on this forum (I greatly appreciate the insight btw!). This process, although a bit tedious, worked well. I then packaged the output from MMM in a VS '05 installer project and removed the UAC prompt on the msi using msiinfo.exe. Now I am faced with installing an application that basically lives in an Excel file. I modified a manifest that MMM created for me for one of my VB6 apps and tried to run the excel file through that, but I did not have much luck. Does anybody know of a way to do this? Does RegFree com work with VBA? Any thoughts or suggestions would be much appreciated.
Thanks,
Steve
Yes, it is possible to use registration-free COM through VBA, on Win2k3+.
Fundamentally, reg-free says "this COM class no longer needs to be registered to be discoverable, instead registration info will be carried by a manifest".
Manifests themselves are implictly referenced by executables when they are embedded in the executable, or named *.exe.manifest.
However, in the case of VBA -- your code doesn't live in an executable you control, so you need another way to get a reference to the manifest.
That's where the Microsoft.Windows.ActCtx object comes in - it specifically allows you to instantiate your object given an explicit manifest reference.
For example (in JS, since I'm rusty on VBA syntax):
var actCtx = WScript.CreateObject("Microsoft.Windows.ActCtx");
actCtx.Manifest = "myregfree.manifest";
var obj = actCtx.CreateObject("MyObj");

Resources