Automate MS project - vb.net

Is there a way that we can automate the input in ms project 2010. Below are the scenarios:
We have a vb.net application that uses to inputs task name, hours, estimate and completion date time.
Is there a way that we can upload those date in ms project 2010.

There is a way. If you use desktop version of MS Project (Pro or Standard) then the only option you have is to use OLE automation.
Through the OLE Automation you will get a reference to an instance of Application class which is key class in every MS Office application. From the Application you can get a list of currently open projects using Application.Projects collection or even get current project using Application.ActiveProject.
As soon as you have a reference to a project you can access all tasks in the project using Project.Tasks collection. (Index of all collections starts with 1)
The most of Task fields like Name or Start date are available through properties of a Task: Task.Name = "something" or Task.StartDate = "1/1/2001"
Anyway here is a link: msdn.microsoft.com
Another story is if you have Project Server and you want to do all the things faster. In this case you should use PSI (Project Server Interface) - collection of web services which give you access to the most of Project Server functions.
MSDN has great articles with samples how to work with projects using PSI and here is a link: MSDN about PSI. You can search around the link to find more articles about other services available through PSI.

If you're able to put your data into Excel as mentioned in your comment, then it would be fairly straightforward to write a VBA program that reads the excel data and updates the Project tasks with the data in the workbook.

Related

How do I build an MS Project team with VBA?

I have an MS Project Server 2010 running with a number of enterprise resources set up. I need to create a project via VBA, populate it with tasks and assign enterprise resources to tasks.
I am capable of creating tasks and assigning project resources to them, but I cannot assign enterprise resources. Once I create a new project, its resource list is empty. I can add enterprise resources to the project manually with TeamBuilder, and then they can be assigned, but I don't see a way to add enterprise resources to project via VBA. I tried to record a macro while adding resources, but it doesn't reflect the process and allows me only to open TeamBuilder.
How can I add enterprise resources to my project?
Well, I did find an answer. It's EnterpriseResourceGet method of Project app. Probably it will save someone some nerve and let curse Microsoft a bit less. Getting resource UID via VBA is a different and fascinating story.

How do I upload an Excel sheet to a SQL table in a Lightswitch web client?

I have a lightswitch project in visual studio 2013, using vb.net. I would like the user to be able to click a button and have lightswitch find an excel file, and upload that file to a sql table according to a pre-determined column mapping.
My preference was to use the Office Integration extension for visual studio, which I got working with VS 2013 by downloading it from this link: http://www.ge.tt/71iuRQv/v/0
However, the documentation and examples for office integration seem to be very heavy on getting an excel spreadsheet into a display in the lightswitch web client, rather than into the sql data table, which is where I need it. Here are the examples I've been following:
http://blogs.msdn.com/b/bethmassi/archive/2012/07/18/new-and-improved-office-integration-pack-extension-for-lightswitch.aspx
Alternatively, I have an existing stored procedure, and I can request that the server call this stored proc by sending a web API extension from the client to the server. I have this working already for other stored procs, according to examples from Beth Masi and Paul van Bladel. (Stackoverflow won't let me post the links...)
The undesirable part of this approach is that the stored proc is old, and messy.
I've searched and searched, but have yet to find anyone approach this problem for VS 2013 with lightswitch. Any useful advice?
I've used the method detailed by Matt Sampson to store word files and it works very well. Since it just stores the raw binary it should handle Excel files just as well.
If you're creating the table in LightSwitch, use the Binary Type. If you use SQL create scripts use varbinary(MAX).
You need to create a custom Silverlight dialog box to gain access to the OpenFileDialog object. Then open the file in as a FileStream.
Finally, you need to add a handler for the closed method of the control and then show the control to the user. Most likely done in a button. This needs to be done on the main dispatcher.
The code examples are in C# but I just used one of the many available translators out on the web and copy/pasted the VB.NET code.
Another option might be to consider shelling out to the DTSEXEC run-time to execute an SSIS package to perform the upload - especially if the target Excel spreadsheets have predefined layouts and content data types.
Even simpler, you might be able to use the SQL Server BULK INSERT command to get the job done - although that would require a SQL Client connection to your database.
HTH

Enterprise Lookup Tables

I have Microsoft Project 2010 Server.
How can I read all values defined for enterprise lookup table from inside of Microsoft Project 2010? I use VSTO.
Have already tried Application.GlobalOutlineCodes, Application.ActiveProject.OutlineCodes with no luck.
The easiest way is to read the data through PSI - you just call PSI from your VSTO add-on. Of course you can read LookupTable from MS Project, but COM is much slower than PSI calls over WCF or .asmx.
I keep a reference to all enterprise custom fields in my add-ons and lookups for them cached. Here is a sample how to read Custom fields and Lookups for them using PSI

MS Project data in SQL Server

I have been given the task to Load all our company's project data from MS Project into SQL Server to be able to create reports and dashboards from the project data.
I know you can export a specific projects data into a access database, but every project must have it's own access database. So my first thoughts was to create some kind of dynamic access SSIS connector and ETL. So that the project managers export their projects to access and the SSIS package takes care of the rest.
Is there a simpler way of doing this?
My company also have a SharePoint infrastructure as well as SAP BusinessObjects infrastructure. Is there a way I can accomplish this by the use of SharePoint or bobj
The simplest but costy way is called MS Project Server - it stores all data in MS SQL database already, has precalculated reporting database and so on. Here is a link http://technet.microsoft.com/en-us/evalcenter/hh973404.aspx. The last version can be either installed locally or hosted by Microsoft.
Another option I see is to use kind of automation around MS Project which will load project plan, extract all interested information and upload to to your database. There is no big magic in this solution.
The third option is to export projects to XML and then use the XML to upload data to SQL Server database. This solution is also doable through Project automation
After defining your database and column structure in SQL Server, just use Project VBA to A) collect the project and task data into an array, B) set a connection string to your database, then C) send it. I have created several applications around this procedure and it works very well.

Is there any simple way to crawl all of the SharePoint 2010 site information to save it into a database?

I'm working with Visual Studio 2010 and Sharepoint 2010. I would like to know if there's a way to have a web part that crawls all the data within a SharePoint site so I can save it into a custom db.
You can certainly create a custom web part that will do this. I do not know of an out of the box web part that will work. I began writing something like this when I found SharePoint List Source and Destination. It's a CodePlex project for an SSIS SharePoint adapter. We did not need a user interface for the extract, so we used it successfully last year for transferring data between SQL Server and SharePoint.
Sounds like all you need to do is use the API, OOB web services, or the Client OM to write some code and access the lists directly. Which approach you take depends mostly on where the code will run.
Well I found this article - Document Library Tree View Web Part for SharePoint - it is a Web Part that shows all the info of any of the document libraries within a site. At least I know how to crawl that kind of library.