Click or drag to resize

IDatabaseCreateProjectMember Method

Create a new ProjectMember object.

Namespace:  SuperOffice.COM.SuperOfficeDB
Assembly:  SuperOfficeDB.Interop (in SuperOfficeDB.Interop.dll) Version: 8.0.0.0
Syntax
SOProjectMember CreateProjectMember()

Return Value

Type: SOProjectMember
SOProject - an empty project object SOProjectMember – a new Project Member
Examples

Create a new project

This text may be copied to the notepad, and saved as a *.vbs file. Remember to change the login information.

VB
Dim soDB, myProject, msg
enPublishTypeExternal = 1
enTableProjStatus = 88
enTableProjType = 85

Set soDB = CreateObject("SuperOfficeDB.Database")
If soDB.Login ("USERNAME", "PASSWORD") Then


    Set myProject = soDB.CreateProject
    myProject.SetDefaults
    myProject.Name = "Summer party 2007"
    'This will be automagically set for you by using SetDefaults
    myProject.Associate = soDB.GetAssociate(soDB.UserAssociateId)
    myProject.Description = "The annual summer party where we invite all our large customers"
    myProject.PostItText = "This years we will do a barbeque"
    'This will fail if there is no "c:\summerparty.jpg"
    myProject.Picture.ReadFromFile ("c:\summerparty.jpg")
    'The project will be available through audience
    myProject.PublishType = enPublishTypeExternal
    myProject.Urls.Add "www.summerparty.xxx", "The summerparty website"
    'This will be automagically set for you by using SetDefaults
    myProject.ProjectNumber= 1234
    myProject.Status = soDB.GetListItemByName(enTableProjStatus, "Planned")
    myProject.Type  =  soDB.GetListItemByName (enTableProjType, "Other")

    If myProject.Sentry.AreAllRequiredFieldsFilled = True Then
        myProject.Save
        msg = msg & "Project saved with project_id = " & myProject.Identity & vbCrLf 
        msg = msg & "Project is created by " & myProject.CreatedAssociate.FullName & " at " & myProject.CreatedDate & vbCrLf 
        msg = msg & "and belongs to usergroup " & myProject.Group.Text & vbCrLf 
        If myProject.UpdatedDate > #1/1/1970# then
            msg = msg & "Project was last updated by: " & myProject.UpdatedAssociate.FullName & " at " & myProject.UpdatedDate 
        End If

        MsgBox msg

    End If

else
    MsgBox "Unable to log in"
end if
Set soDB = Nothing

Create a new projectmember

This text may be copied to the notepad, and saved as a *.vbs file. You need a running CRM 5 to make it work. (This example uses the SuperOffice COM application library and not the SuperOffice db library interface).

VB
dim objdb
dim objapp
dim objproject
dim objperson
dim objprojectmember

Set objapp = CreateObject("SuperOffice.Application")
if not (objapp is nothing) then
    objdb = objapp.Database
    objperson = objapp.Database.GetPerson(3)
    objproject = objapp.CurrentProject
    objprojectmember = objdb.CreateProjectMember
    objprojectmember.SetDefaults()
    objprojectmember.PersonId = objperson.Identity
    objprojectmember.ContactId = objperson.Contact.Identity
    objprojectmember.project = objproject
    objprojectmember.Save()
    MsgBox "ferdig"
else
    msgbox  "unable to connect to database"
end if
set objapp = nothing

See Also