Linking records to containers with value 0

Hi

Our organisation has created a "project" record type with  a container value of 0.
They link folders from other sections into this projects container that relate to a common project.

I would like to write some code that will allow them via  a webpage to link folders and files into this project container. Unfortunately the error message I get is

"A record of type 'Project' cannot be used as a container - it has a container level of 0."

Can someone tell me how I might go about fixing this.

My test code so far is below, sorry about the formatting

protected void btnDocumentCreate()
{
 
String
txtSubFolder = "title:Bills test project";
  String txtDocumentNewRec = "ScheduleDocument_" DateTime.Now;
  String IdNumber=""
  try
  {

      //string username = fnUserIdentity();
      using (Database objDB = new Database())
      {

            objDB.Id = DataSetId;
            objDB.WorkgroupServerName = ServerName;
            objDB.TrustedUser = "Bill Sigar";
            objDB.Connect();

            TrimMainObjectSearch objSearch = new TrimMainObjectSearch(objDB, BaseObjectTypes.Record);

             objSearch.SetSearchString(txtSubFolder);

             foreach (Record thisObjRec in objSearch)
            {

                IdNumber = thisObjRec.Number;
            }

        if (!(String.IsNullOrEmpty(IdNumber)))
         {

            RecordType objRecType = new RecordType(objDB, "Document");
            Record objRec = new Record(objDB, objRecType);
            Record objContainer = new Record(objDB, IdNumber);
            objRec.TypedTitle = txtDocumentNewRec;

            objRec.SetContainer(objContainer, true);
           objRec.Save();

        }

       objDB.Disconnect();

     }
}

catch (Exception ex)
{
  
System.Diagnostics.Trace.WriteLine(ex.Message);  
   txtError.Text = ex.Message;
}

Parents Reply Children
No Data