Writing a "Find" routine

S

Systellence

Hello everybody!

I have to write a function which has to search through all MS Projects files
and pickup a file for a specific search string. I am not that familiar with
MS Projects, but it seems not difficult to use. The Search Function in MS
Projects supplies a list of different fields in which one can search etc.

PLEASE, can anybody help me on this. I have to develop this in C#.

Hope to hear from you soon!

Jaco Pretorius
 
H

HansH

Are you using Microsoft Project in a stand-alone scenario, or using
Project Server?

In the stand-alone scenario, you would have to write a routine that
opens each individual project file and search for whatever you are
searching for.
In the Project Server scenario, you could query the database for all
projects that meet your search query.

I hope this helps,
Hans

Projectopolis <http://msepm.hsquared.be>
 
S

Systellence

Hello Hans

Thanks for the feedback. That I have just done in C#. It is a stand-alone
scenario.

It is possible to search for something using the ApplicationClass object,
but not for the Project Object. I guess searching is done for the active
project by using Application Object?

Do you have sample code maybe or knows where to find sample code? It seems
that for MS Project code and information is not so available as for the rest.

Kind regards

Jaco
 
H

HansH

Sorry, I have no sample code for that.

The Find, FindNext, ... functions search in the ActiveProject.
Using the Application.Projects collection, you can run through all open
projects. And using 'ProjectObject'.Activate, you can activate any
project from the collection.

What exactly are you trying to achieve? Searching on task information?
Resource information? And what do you need to do with the data found?

Because in some cases, it might be easier to write your own 'Find'
routine. Something like this:

Sub MyOwn FindSub

Dim Tsk as Task

For Each Tsk in ActiveProject.Tasks
If Not Tsk is Nothing Then
<Do your search magic in here>
End If
Next

End Sub

I hope this helps,
Hans

Projectopolis <http://msepm.hsquared.be>
 
S

Systellence

Hi Hans

In the mean time I had some success in writing this search routine. I am
busy with a document management system which has a specialized search
function.

As with Microsoft Project, this search function can also specify the search
item, field to search for and test (equal, less than etc...) The only problem
I have now is to actually know which type of input is valid for which type of
field and test. This seems to be a bit difficult :-(
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top