Asked by:
how to save .mpp file to project server database programatically.

Question
-
hi,
can any one suggest.
how to save .mpp file to project server database programatically.Thanks & Regards, Krishna
Monday, October 22, 2012 1:33 PM
All replies
-
You can write a VBA macro to do this which can run under project professional. I don't have sample code available with me, but you can easily get the bulk of the code by:
Open Project Pro (connected to the server)
Turn on the macro recorder
Save a project to the database
Turn off the macro recorder
Hit ALT+F11 to open the visual basic editor.
The code that produced can now be edited to accept a variable with the file name.
Add a line:
displayalerts = "false" 'this turns off pop-up messages and accepts the default value
Then write code to read in values for the file name variable.
I've done this by reading from an excel list.
It is a good idea to write out a log if you are saving multiple files. Sometimes a stuck queue or other things can cause problems and you want to know which files made it and which did not.
Jack Dahlgren blogs at:
Project and Retrovention
and rarely TwitterMonday, October 22, 2012 10:57 PM -
Thanks for Quick reply Jack.
But i need to upload the .mpp files which got uploaded into my intranet sharepoint site to project server DB.So the above reply may not meet this i hope.can you suggest any possible ways on this.
Thanks & Regards, Krishna
Wednesday, October 24, 2012 12:27 PM -
Hi Krishna--
The storage of project files on SharePoint library & project server are quite different.
You have only one way to save a project to project server from existing file, open the files in MSproject via connecting to server & Save to project server. Would suggest to manually save the project to project server if you have small no of project but if you have very large number of project, the steps to write a solution (.NET solution)
1. Use a specific custom page/layout page or a windows app that connects to SharePoint library having the MS project files.
2. On a button click event, launch the MS project
3. get the Item index from library & open each project one by one based on flag field/column in list "Migrated to EPM server" , If you have a false value, open the project & save to project server using MS project application objects as Jack suggested (from a macro)Hope that helps.
If you found this post helpful, please “Vote as Helpful”. If it answered your question, please “Mark as Answer”. Thanks, Amit Khare |EPM Consultant| Blog: http://amitkhare82.blogspot.com http://www.linkedin.com/in/amitkhare82
Thursday, October 25, 2012 6:37 AM -
Thanks for Quick Reply Amit,
but from above approach which you suggest i have doubt in third point.
3. get the Item index from library & open each project one by one based on flag field/column in list "Migrated to EPM server" , If you have a false value, open the project & save to project server using MS project application objects as Jack suggested (from a macro)
Can you please clarify:how to , open the project & save to project server using MS project application, as many of the users who uploads the .mpp to our portal wont be having any "Porject server Accounts" available on there "Microsft Project Proffesional " available where they are going to create .mpp from there "MPP" installled machines.
Thanks & Regards, Krishna
- Edited by krishna_2012 Thursday, October 25, 2012 7:06 AM
Thursday, October 25, 2012 7:05 AM -
Hi Krishna--
Using the .NET code, Launch the MS Project, You will definitely need an account to save a project to server. I believe that with small change in process, You can get this done without customization. Since all your project managers are having the Project professional 2010, you can setup their account in PWA & let them access project server using MS project pro 2010.
They are already using the SharePoint portal & if they use Project server , they can have flexibility to use a project management system with SharePoint collaboration. Is there any reason why you are not willing to give them access to Project Server?
How the custom solution be utilized? Will someone from organization run the solution on a regular basis ?
Please see below article using the PSI, you can create a project using the XML.
http://msdn.microsoft.com/en-us/library/office/gg223766.aspx
Another way if you use a SharePoint Task list & have a solution to use PSI to create project using Task list
http://msdn.microsoft.com/en-us/library/office/gg208849.aspx
If you found this post helpful, please “Vote as Helpful”. If it answered your question, please “Mark as Answer”. Thanks, Amit Khare |EPM Consultant| Blog: http://amitkhare82.blogspot.com http://www.linkedin.com/in/amitkhare82
- Edited by Amit Khare - Project Management Consultant Thursday, October 25, 2012 9:04 AM
Thursday, October 25, 2012 9:02 AM -
Thanks for Reply Amit,
The reason why we are not willing to give them access to Project Server?
In our portal which is apart from project server.we are providing the Users/Managers to upload there .mpp which got developed offline in microsoft Proffesional.Once they got uploaded sucessfully to the portal.
we had many more interlated custom webparts in the portal which will get to work, once we able to create the project for the uploaded .mpp in Project server.
Amit can you provide any better approaches/suggestions on this.
Thanks & Regards, Krishna
- Edited by krishna_2012 Thursday, October 25, 2012 9:14 AM
Thursday, October 25, 2012 9:07 AM -
I try to record the macro to publish the project.It got generated below VBA
Sub PublishProject()
' Macro PublishProject
' Macro Recorded Mon 10/29/12 by XYZDomain\XYZUSER.
FileSaveAs Name:="<>\TestProject", FormatID:=""
Publish WssUrl:="http://Server:Port/PWA/TestProject"
End SubBut after converting into C# no way its getting help full for me to publish the mpp to project server.Can you suggest on this any better.
Thanks & Regards, Krishna
Tuesday, October 30, 2012 6:13 AM