Thomas's Profile
Agile User
7
Points

Questions
1

Answers
1

  • Agile User Asked 7 days ago in Agile PLM (v9).

    Also here is the error I am getting.

     

    private static void addAttachment(System.Net.ICredentials cred, String classIdentifier, String partNumber, String fileName, String rev, String outpath)
    {

    try
    {

    AttachmentService.AttachmentService service = new AttachmentService.AttachmentService();
    service.Url = config.Url + “/Attachment”;
    service.Credentials = cred;

    AttachmentService.AddFileAttachmentRequestType AddFileAttachmentRequestType = new AttachmentService.AddFileAttachmentRequestType();
    AttachmentService.AgileAddFileAttachmentRequest[] agileAddFileAttachmentRequest = new AttachmentService.AgileAddFileAttachmentRequest[1];
    agileAddFileAttachmentRequest[0] = new AttachmentService.AgileAddFileAttachmentRequest();
    agileAddFileAttachmentRequest[0].classIdentifier = classIdentifier;
    agileAddFileAttachmentRequest[0].objectNumber = partNumber;

    AttachmentService.PropertyType[] options = new AttachmentService.PropertyType[1];
    options[0] = new AttachmentService.PropertyType();
    options[0].propertyName = “revision”;
    options[0].propertyValue = rev;

    agileAddFileAttachmentRequest[0].options = options;

    AttachmentService.AgileAddFileAttachmentRequestType[] attachments = new AttachmentService.AgileAddFileAttachmentRequestType[1];
    attachments[0] = new AttachmentService.AgileAddFileAttachmentRequestType();

    agileAddFileAttachmentRequest[0].attachments = attachments;
    AddFileAttachmentRequestType.requests = agileAddFileAttachmentRequest;
    AttachmentService.AddFileAttachmentResponseType addFileAttachmentResponseType = service.addFileAttachment(AddFileAttachmentRequestType);

    String statusCode = addFileAttachmentResponseType.statusCode.ToString();

    FileDataSource datasource = new FileDataSource(fileName);
    attachments[0].getContent(new DataHandler(datasource));
    agileAddFileAttachmentRequest[0].getAttachments().add(attachments);

    }

    catch (Exception ex)
    {
    Console.WriteLine(ex.Message);
    return;
    }
    }

     

    Error CS1061 ‘AgileAddFileAttachmentRequest’ does not contain a definition for ‘getAttachments’ and no accessible extension method ‘getAttachments’ accepting a first argument of type ‘AgileAddFileAttachmentRequest’ could be found (are you missing a using directive or an assembly reference?) AgileAddAttach C:\Users\sthomas\Documents\AgileAddAttach\AgileAddAttach\AgileAddAttach\Program.cs 152 Active

    Error CS1061 ‘AgileAddFileAttachmentRequestType’ does not contain a definition for ‘getContent’ and no accessible extension method ‘getContent’ accepting a first argument of type ‘AgileAddFileAttachmentRequestType’ could be found (are you missing a using directive or an assembly reference?) AgileAddAttach C:\Users\sthomas\Documents\AgileAddAttach\AgileAddAttach\AgileAddAttach\Program.cs 151 Active

    • 102 views
    • 1 answers
    • 0 votes