Add document to document library with additional column data using Powershell - powershell

I'm trying to loop through pdf files in a directory and send them to a sharepoint document library. When I send them I would like to add the customer, invoice, etc to the list as well. Anyone have recommendations?

Sure. This can done fairly easily. Here's the article I've used in the past for reference:
http://blogs.technet.com/b/heyscriptingguy/archive/2010/09/23/use-powershell-cmdlets-to-manage-sharepoint-document-libraries.aspx
Setting metadata should be pretty easy as well, but PowerShell can't guess what a customer, invoice, etc is. So you'll have to have some data source. If the filename contains the data, you could split it. If the data is in the file itself, there are some methods of getting plaintext strings out of a PDF, but it's going to be a bit harder than the first part of your request.
Let me know if I can help further with any specifics.

Related

Can I refresh all the Word Document metadata using DocumentFormat.OpenXml

I have an application that uses the DocumentFormat.OpenXml API to a Word document from one or more originating documents, inserting and deleting chunks of data as it goes. In other words, the resulting document will be significantly different from the constituent documents.
I have already successfully created things like Custom Document Properties, Document Variables and Core File Properties.
But: is it possible to get the other metadata items (number of pages, words, paragraphs, etc.) refreshed, without actually having to calculate these?
Thank you to #Cindy Meister for the answer.
I was hoping that there might be some method or other in the DocumentFormat.OpenXML SDK that I could call, but it seems that is not possible.

MarkLogic "XDMP-FRAGTOOLARGE" error while storing 200MB+ File using REST

When i try to store a 200MB+ xml file to marklogic using REST it gives the following error "XDMP-FRAGTOOLARGE: Fragment of /testdata/upload/submit.xml too large for in-memory storage".
I have tried the Fragment Roots and Fragment Parents option but still gets the same error.
But when i store the file without '.xml' extension in uri. it saves the file but not Xquery operations can be performed on it.
MarkLogic won't be able to derive the mime from the uri without extension. It will then fall back to storing it as binary.
I think that if you would use xdmp:document-load from QConsole, you might be able to load it correctly, as that will not try to hold the entire document in memory first. It won't help you much though, you will likely hit the same error elsewhere. The REST api will have to pass it through in memory, so that won't work like this.
You could raise memory settings in the Admin UI, but you are generally better off by splitting your input. MarkLogic Content Pump (MLCP) will allow you to do so using the aggregate_record options. That will split the file into smaller pieces based on a particular element, and store these as separate documents inside MarkLogic.
HTH!

distributing pivot graphs to departments through email efficiently

I work at an institution with a lot of departments and subdivisions. I have an "excel-database" with pivotcharts that can show the results for the progress of the different departments and subdivisions, but there are quite a lot, and to get through all graphs (Dep 1, subdivision 1, Dep 1 subdivision 2, etc...) I have to go through quite a bunch of iterations sending out the graphs for each department and subdivision.
I'm considering creating a macro - that selects each option in the pivotchart and then exports to a word document, but I don't know if there's an easier way to go, since I guess thiss will take me quite some time too.
I'm thinking that someone probably has been in the same situation, so if anyone has any suggestions as to how this could be solved efficiently, please let me know.
EDIT:
So as I see it there are three steps to this question that need solving (steps that are striked are steps that I know how to do)
Iterate through pivot table options
Copy charts to word OR other excel file and save
attach that file to a mail, and send it to the correct department-mail
The general thinking about how to handle a case like yours has changed over the years. Currently I would recommend making the data accessible on an internal website of some kind and allowing each department to generate their own graph on demand. They would then be able to look at the data whenever they wanted and you would not have to send out graphs. See if Google Drive or MS Office365 can do this for you.

Exporting Data to Mail in CSV format

I have a list of Expenses Which include date,categoryName and Amount stored in Coredata.
I want them to be transferred in CSV Format to Mail.Can this be done?.I also want only the data in the current month to be sent.
I googled it and all i found is CHCSV parser and i have no idea on how to use it.
Converting your data to csv should be easy, just declare a mutable string, iterate over the objects you want to add and add the values you need to the string with comma seperation (best to enclose the data values in "", too). You can google on the csv format in wiki.
Then you write that string to a temp .csv file.
Then, using mfmailcomposer, you attach the .csv-file to the mail and you're done.
If you don't come up with a solution by googling these pieces of information, ask a more specific follow-up question here. But there are many resources on mfmailcomposer with examples out there.
Cheers

Zend_Form: Newbie with non-standard form. Should I still use Zend_Form?

!!! UPDATED !!!
We have spreadsheets of complex product data coming in from multiple sources (internal, customers, vendors).
Since the authorship is so diverse, it's impractical to try governing formatting details such as column order and the number of header-rows.
These CSV spreadsheets will be uploaded to our DB via an existing form.
(My first Zend_Form ... I'm almost done with it)
The user needs to see a sample from a given spreadsheet so they can Map the columns and start-row.
To achieve that, I need to generate an html table of that dynamic content, and weave the form elements in and around the table data.
The user would select which values are to be found in each column, and identify the first row of data (after any header rows).
CLICK HERE to see an example.
(NOTE: Most of my work here is under an NDA, so contrived examples is the best we can get :)
In this example, I'd expect the output to be:
_POST('first_row'=>2, 'column0'=>'mi', 'column1'=>'lName', 'column2'=>'fName', 'column3'=>'gender')
With all those scpecifics mapped/defined, the uploaded spreadsheet can then be parsed and accurate data can be added to the product_history database.
Is ZF a good tool for this particular problem, or should I just write something from scratch?
How would you aproach this?
I am finally JUST BARELY starting to get this ZF stuff straight in my head, and this one has got me totally lost :)
Any and All advice appreciated.
~ Mo
I think in your case, using Zend_Form would be helpful for this situation.
The tricky part to it is of course that your forms are going to be largely dynamically generated on-the-fly based on the header and first row content of the CSV file.
Whether you used Zend_Form, or pure PHP, or some other solution, a lot of what you will be doing is the same (analyzing the CSV, providing dynamic inputs based on the CSV, and then error checking the selections). I think using Zend_Form has the advantage of making something like this very cleanly.
Given Zend_Form's nature, e.g. how it validates existing forms based on the elements added to the Zend_Form itself, you need to take a special approach with the form. Basically, after the user uploads the CSV once, you will create a Zend_Form object based on the number of columns, their positions in the CSV, and the name of the column.
Since you don't want to bother the user to upload the CSV multiple times if they make incorrect selections, I would parse the CSV into some sort of structure, maybe a simple object or array, and then build your Zend_Form based on that data. This way, you can save that structure to the session, so you can continue to regenerate the form based on the parsed data without having to read the file each time. This is because the main challenge with Zend_Form and dynamic forms, is that not only does the form need all of the elements and their properties when you want to display the form, but they are also required in order to validate the form and re-display the validated form.
I remember seeing this functionality many years ago in a PHP script, which I found is still available. Perhaps you could look at it for ideas. I won't post the link here since the screenshots and script are mostly adult website related and the site is NSFW for the most part, but it is called TGPX by JMBSoft. The 7th of the 8th screenshot on the main product page shows the import process where it lets the user map fields to data, exactly what you are doing.
Hope my advice is helpful, feel free to comment with any questions.