public static void saveResources(SaveResourceType res)
 {
     try
     {
         String response = sendPostCommand("/saveResource", res.ToString());
     }
     catch (Exception ex)
     {
         logError(ex);
     }
 }
    private static void saveResourceFunctions()
    {
        try {
            String projectName = null;

            String idToken = CollaborationTool.login("", "");
            if (idToken != null)
            {
                //Open projects list
                try {
                    List <ProjectType> prjList = CollaborationTool.getProjectList(idToken);
                    foreach (ProjectType prj in prjList)
                    {
                        if (prj.name.Equals("CAD1"))
                        {
                            projectName = prj.name;
                            break;
                        }
                    }
                } catch (Exception e) {
                    projectName = null;
                }
            }

            CollaborationTool.startCollaborate(idToken, projectName);

            // Setup done
            // ----------------------
            // Test save resource

            if (idToken == null)
            {
                return;
            }
            if (projectName == null)
            {
                return;
            }

            ResourceType res   = new ResourceType(projectName, "IMG_ART333", "png");
            byte[]       data2 = File.ReadAllBytes("C:\\Users\\ggariddi\\Pictures\\CAD_IMAGE\\CAD_IMAGE\\1869_50_4.png");
            res.resource = Convert.ToBase64String(data2);
            //res.resource = (new BytesType(data2));
            SaveResourceType resToSave = new SaveResourceType(idToken);
            resToSave.resources.Add(res);

            Debug.Print(resToSave.ToString());
            CollaborationTool.saveResources(resToSave);
        } catch (Exception e) {
            logError(e);
        }
    }