I'm building an app that automatically labels Office files on Windows computers. To apply my sensitivity labels to documents programmatically, Microsoft tells me to use its MIP SDK.
But the SDK is in C++, with some convoluted async Observer patterns, so it's not clear to me how to call its functions from Python.
Has anyone succeeded in using the MIP SDK with Python 3? Can you share a concrete Python example of calling the SetLabel() function on a file?
I have spent sometime looking into this problem. Microsoft doesn't make it clear on how to call their MIP C++ code using Python. It's also unclear for me if you're trying to set sensitivity labels on local Office files or ones stored in SharePoint or in Office 365.
I previously mentioned using Python Bindings, but after doing some research there are other ways.
Technique One
Microsoft has a PowerShell framework called Security & Compliance Center PowerShell. One the cmdlet is Set-Label, which can be used to enable sensitivity labels for Office files. There is another module called Set-LabelPolicy that can assist in setting global sensitivity
policies.
PowerShell cmdlet can be called from Python. There are lots of examples on Stack Overflow on how to accomplish this.
Technique Two
Again Microsoft really requires you to dig for information to use Python over their prefer coding languages.
Microsoft has a GitHub project called AutoRest Python. This project generates Python code that is needed to interact with Microsoft Information Protection (MIP) and other Microsoft centric products.
The other GitHub project that is needed is msrest for python.
If you dig through some of Microsoft GitHub repositories you will find examples on how to use these modules.
Technique Three
You can also use Python to set registry settings related to sensitivity labels for Office files. If needed I can provide you the registry keys.
Related
I wanted to know some general throughts about Marmalade and AppEasy. http://www.appeasymobile.com/
I've been following DrMop's tutorials on creating a game engine in Marmalade but noticed that since the tutorials he's gone on to make AppEasy(with others). I have looked at it and have a couple of immediate concerns
1) How easily I can incorporate text files/xml files with XOML.
2) What degree of control I would have over the code base.
3) How deep the engine is and whether it has any comparitable rivels which are better.
I've started the project I'm working on with the IWGame engine that DrMop was using in his tutorials but was wondering that if all my fears are unfounded if it is worth carrying on?
Cheers,
Support for IwGame is coming to a close. IwGame is being replaced by the AppEasy Core SDK, which is an open source portable engine where Marmalade is just one of the platforms that it plans to support. AppEasy Core will also be open source so others can contribute to its development, submit bug fixes etc..
XOML + Lua or XOML + C++ or all 3 used together provide a very powerful easy to use environment. You can easily integrate text files, XML files, image files, sound files etc. You should check out the official web site appeasymobile, theres plenty of documentation and a drag and drop app builder that spits out cross platform apps based on XOML + Lua.
Cocos2d-x is a good alternative, but you will need to set up each dev environment for each platform you plan to support (massive pain to do) as it doesn't cross platform compile stuff for you. Although Marmalade do now have a stable interface to Cocos2dx which enables you to use Cocos2dx cross multiple platforms.
I am trying to develop a WinRT DLL which uses SQLite to write database.
But it seems like some win32 APIs in SQLite source code are not supported by metro, such as, LoadLibraryW, GetTempPathA.
Is there any way to compile SQLite source code or use SQLite with WinRT DLL?
Well you could always link sqlite3 statically and define new functions for accessing files etc via sqlite3_vfs.
In VS2012 there is an extension now called SQLite for Windows Runtime. You can download and install this via Visual Studio (requires a restart of the IDE). Then, go to your WinRT project, Add a Reference, under "Windows" choose "Extensions" and you should see it.
There's a winrt branch of SQLite now that only uses supported API. On top of that, we implemented SQLite3-WinRT, a WinRT component that allows using SQLite in any of the WinRT languages.
rename sqlite3.c to sqlite3.cpp
replace LoadLibrary with LoadPackagedLibrary
Fix lots of syntax errors.
From the SQLite site
SQLite version 3.7.13 adds support for WinRT and metro style applications for Microsoft Windows 8. The 3.7.13 release is coming sooner than is usual after the previous release in order to get this new capability into the hands of developers. To use SQLite in a metro style application, compile with the -DSQLITE_OS_WINRT flag. Because of the increased application security and safety requirements of WinRT, all database filenames should be full pathnames. Note that SQLite is not capable of accessing databases outside the installation directory and application data directory. This restriction is another security and safety feature of WinRT. Apart from these restrictions, SQLite should work exactly the same on WinRT as it does on every other system.
Tim Heuer provides a walk-through of building a metro app using SQLite on his blog
Let me add some remarks on using sqlite/winrt that may save you some headaches:
Winrt allows you to write only to specific folder (c:\users\<user>\My documents\<app>). You have to put your DB here. (Trivial in managed environment.)
Time from time Sqlite uses temp files. (Complex queries that need transient indices, vacuum etc.) These files also must be created in the app folder, but sqlite won't do this unless you set it with temp_store_directory pragma. If you don't do this, you may get random user bug reports.
Note that above pragma is officially deprecated. Ignore this. Native coders might be tempted to use global variable sqlite3_temp_directory instead (encouraged way), but the current binary release (dll) does not publish this variable. (You can do it yourself, but then change sqlite sources and use _declspec(dllexport) attribute; def file does not work.)
Don't rely too much on sqlite file operations. The implementation is not particularly good. For example testing of write access will succeed even if you don't have write permissions.
Apart from this there seem to be no problems with winrt. More advanced users might supply their own (better) winrt driver. It is not too difficult...
I have recently completed a detailed investigation regarding GP functional test automation possibilities with QTP, TestComplete, and other GUI recognition/interaction tools.
In short, none of the tools acted well. Mentioned above did best but still featured a lot of hard-coding in recorded sample scripts. QTP did significantly better though.
Some of the GUI were recognized under .NET (swf... in QTP) and handled well. Some other were recognized as swfObject only but accessing native methods and properties allowed performing required interaction.
Finally, object internally named "Microsoft.Dexterity.Shell.DexDialogHost" renders objects that seem don't have Windows Handle and thus unrecognizable by QTP. I haven't found any detailed documentation on those objects family (like class reference to find out names of methods).
So I was wondering if someone could share experience automating GP and what tools / approach were used.
Thanks.
If QTP doesn't recognise some controls you can extend the set of controls it supports by using .NET Extensibility. This allows you to add new functionality which is relevant for these controls but is not supported out of the box by QTP. Note that some .NET programming is required.
The documentation for .NET Extensibility is available at Start > Programs > QuickTest Professional > Extensibility > Documentation > .NET Add-in Windows Forms Extensibility Help
Fact of the day: The SWF in .NET objects' names in QTP stands for System Windows Forms.
With regards to the objects that were partially successful, the ones you noted were recognized as SwfObject - if these logically map to a standard class, you can configure QTP to treat it as a standard class. For example, if you have an SwfObject that behaves like a button, you can configure QTP to record and replay as if it is a standard button.
[removed suggested keystroke+clipbaord work-around as it is inappropriate for this situation given further information that there are multiple Dexterity dialogs, each with many objects]
It took a while for me to conduct a research, and then practically prove the concept.
I started series of posts about Great Plains automation success story where I put all the details and steps of my investigation along with sample code.
http://automation-beyond.com/2009/08/24/great-plains-automation/
http://automation-beyond.com/2009/08/26/dynamics-great-plains-gui/
http://automation-beyond.com/2009/09/01/gp-automation-utilizing-com/
(to be continued)
Here's the summary.
Microsoft Dynamics Great Plains has its own completely independent GUI/Event system (Dexterity) that makes it cross-platform product. The same thing makes it almost completely "black box" not accessible from outside.
Platform-specific engine supports COM Automation and various integration models for Windows platform. All these are gathered under Continuum Integration Library name.
What is especially useful for Test Automation needs, Continuum provides high-level methods to simulate user inputs for the GUI thus acting the same way as Test Automation Tool does.
Wherever Continuum doesn't cover Test Automation needs, direct calls of sanScript (Dexterity's internal scripting language) could be executed in real-time.
With all the above, I created custom "Dexterity GUI" component for Quick Test Professional enabling functional test automation of Microsoft Dynamics Great Plains application. Of course, without any use of keyboard/mouse hard-coded workarounds.
Thank you.
You can download the .NET Add-In from hp.
link text
What solutions are there? I know only solutions for replacing Bookmarks in Word (.doc) files with Apache POI?
Are there also possibilities to change images, layouts, text-styles in .doc and .ppt documents?
I think about replacement of areas in Word and PowerPoint documents for bulk processing.
Platform: MS-Office 2003
What are your platform limitations?
Obviously Apache POI will get you at least part of the way there.
Microsoft's own COM API's are fairly powerful and are documented here. I would recommend using them if a) you are not running in a server (many users, multithreaded) environment; b) you can have a proper version of powerpoint installed on the production machine; and c) you can code against a COM object model.
It's a bit pricey, but Aspose.Slides is a very powerful library for manipulating PowerPoint files
If you include using other Office suits as an option, here's a list of possible solutions:
Apache POI-HSLF
PowerPoint 2007 APIs
OpenOffice.org UNO
Using POI you can't edit .pptx file format, but you don't depend on the apps installed on the system. Other two options, on the contrary, make use of other apps, but they are definitely better for dealing with presentations. OpenOffice has better compability with older formats, by the way. Also if you use UNO, you'll have a great choice of languages, UNO exists for Java, C++, Python and other languages.
My experience is not directly with Power Point, but I've actually rolled my own WordML (XML) generator. It a) removed all dependencies on Word, b) was very fast c) and let me build up documents from scratch.
But it was a lot of work to create. And I was only creating a write only implementation.
I'm not as familiar with Power Point, so this is conjecture, but you may be able to roll your own by reading XML (Power Point 2003??) and/or cracking the Office Open XML file (zipped XML), then using XPath to manipulate the data, and then saving everything back to disk.
This won't work on older OLE Compound Document based Power Point files though.
I've done something like that before: programmatically accessed and manipulated PowerPoint presentations. Back when I did it, it was all in C++ using COM, but similar principles apply to C#/VB .NET apps, since they do COM interop very easily.
What you're looking for is called the Office Document Model. Basically, Office applications expose their documents programmatically, as trees of objects that define their contents. These objects are accessible via an API, and you can manipulate them, add new ones, and do whatever other processing you want. It's exceedingly powerful; you can use it to manipulate pretty much all aspects of a document. But you'll need an installation of Office and Visual Studio to be able to use it.
Some links:
Intro: http://msdn.microsoft.com/en-us/library/d58327k6.aspx
Hope this helps!
Apparently new users can only include one link per posting. How lame! :)
Here's the other link I meant to include:
Example of manipulating PowerPoint documents programmatically: http://msdn.microsoft.com/en-us/library/cc668192.aspx
We have a VS2005 native C++ application which connects to Exchange
server using CDOEX and CDOEXM to create and modify calendar entries
for multiple user folders. It's a command line utility which must be installed on the same server where the exchange server is installed. What is the correct procedure to use this
utility in a clustered environment? Any help would be appreciated.
Might I suggest you take a look at.
http://msdn.microsoft.com/en-us/library/aa373130%28VS.85%29.aspx
for general information on how failover clustering works.
But I would also like to point out that going forward ( ie exchange 2007 , 2010) you don't get CDOEXM. And Instead you will have to find some way of integrating with powershell instead. There are classes to explicitly run powershell scripting from inside a program, but they are C# so you either migrate all your code to C# or use some bastardized blend of IJW.