Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/list/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Azure functions 在Azure函数中从Project Online创建任务_Azure Functions_Azure Logic Apps_Project Online - Fatal编程技术网

Azure functions 在Azure函数中从Project Online创建任务

Azure functions 在Azure函数中从Project Online创建任务,azure-functions,azure-logic-apps,project-online,Azure Functions,Azure Logic Apps,Project Online,我需要创建一个Azure函数(c#),它从项目在线站点读取项目的任务。之后,这些任务必须在另一个项目在线站点的其他项目中创建 我试着用一个logic应用程序,但Project Online connector不允许我创建taks的所有属性 是否有任何.net库或任何方法可以做到这一点 非常感谢。似乎没有c#library可供我们使用。我在java代码中找到了一种可能对您的问题有帮助的方法,我们也可以在azure函数中编写java代码来实现您的需求: /** * Add a ta

我需要创建一个Azure函数(c#),它从项目在线站点读取项目的任务。之后,这些任务必须在另一个项目在线站点的其他项目中创建

我试着用一个logic应用程序,但Project Online connector不允许我创建taks的所有属性

是否有任何.net库或任何方法可以做到这一点

非常感谢。

似乎没有c#library可供我们使用。我在java代码中找到了一种可能对您的问题有帮助的方法,我们也可以在azure函数中编写java代码来实现您的需求:

    /**
     * Add a task to a given project
     * @param projectID The GUID of the project
     * @param feature The text of the task
     * @param startDate The start date of the task
     * @return true/false on success (see Communications.lastError for details if failed)
     * @throws IOException
     * @throws UnsupportedEncodingException
     * @throws JSONException 
     */
    public boolean addTask(String projectID, String feature, String startDate) throws IOException, UnsupportedEncodingException, JSONException
    {
        JSONObject postData = new JSONObject();
        JSONObject parms = new JSONObject();
        UUID uuid = UUID.randomUUID();
        parms.put("Id", uuid.toString());
        parms.put("Name", feature);
        parms.put("Start", startDate);
        postData.put("parameters", parms);
        CloseableHttpClient httpclient = buildClient();
        String projURL = "/_api/ProjectServer/Projects('" + projectID + "')";
        String digest = getFormDigestValue();
        String fullurl = baseURL + projURL + "/Draft/Tasks/Add";
        HttpPost post = new HttpPost(fullurl);
        post.setHeader("Accept", "application/json;odata=verbose");
        post.setHeader("Content-Type", "application/json;odata=verbose");
        post.setHeader("X-RequestDigest", digest);
        post.setEntity(new StringEntity(postData.toString(0)));
        CloseableHttpResponse response = httpclient.execute(post);
        response.close();
        httpclient.close();
        if (response.getStatusLine().getStatusCode() == 200)
        {
            GUID = uuid.toString();
            return true;
        }
        GUID = "";
        hasError = true;
        lastError = response.getStatusLine().getReasonPhrase();
        return false;
    }
有关上述方法的更多信息,请参阅此