如何使用 microsoft flow - project 在线连接器获取任务的资源名称

How to get resource name for a task using microsoft flow - project online connector

我在 Sharepoint 中使用项目在线 Web 应用程序。我正在尝试使用流连接器 - 项目在线连接器在在线项目中创建新任务时向资源名称发送电子邮件通知。

但我无法找到已创建并分配资源的每个任务的资源名称。

我已尝试使用创建新任务触发器,但任务名称和资源名称未在此触发器的动态内容中一起列出,因此我无法确定为哪个任务分配了哪个资源。

我试过使用创建新资源触发器,但这只在创建新资源时执行,而不是在将新资源分配给任务时执行。所以我的流程是 运行 不停。

触发器- 创建新任务时 根站点 URL - https:/nameofwebsite.sharepoint.com/nameofprojectonlineapp

操作 - 发送电子邮件通知 (V3)(预览版)

至- ResourceName/ResourceEmailID "This option is not available unless i use resource trigger" 主题-返回的任务项目名称 电子邮件正文 - 您必须在 "Returned tasks Task start date" 和 "Returned tasks Task finish date"

内完成此任务

我想在 Microsoft flow 中使用连接器为每个任务查找资源名称

下面是我如何提取资源名称...

首先列出任务

然后你应用到每个输出“返回的任务”

然后在应用到每个

  • 您向 SharePoint 发送 HTTP 请求(我将 ProjectID 存储为变量)

  • 现在您使用来自 HTTP 请求的正文作为内容来解析 JSON

这是架构

{
    "type": "object",
    "properties": {
        "d": {
            "type": "object",
            "properties": {
                "results": {
                    "type": "array",
                    "items": {
                        "type": "object",
                        "properties": {
                            "__metadata": {
                                "type": "object",
                                "properties": {
                                    "id": {
                                        "type": "string"
                                    },
                                    "uri": {
                                        "type": "string"
                                    },
                                    "type": {
                                        "type": "string"
                                    }
                                }
                            },
                            "CustomFields": {
                                "type": "object",
                                "properties": {
                                    "__deferred": {
                                        "type": "object",
                                        "properties": {
                                            "uri": {
                                                "type": "string"
                                            }
                                        }
                                    }
                                }
                            },
                            "Owner": {
                                "type": "object",
                                "properties": {
                                    "__deferred": {
                                        "type": "object",
                                        "properties": {
                                            "uri": {
                                                "type": "string"
                                            }
                                        }
                                    }
                                }
                            },
                            "Parent": {
                                "type": "object",
                                "properties": {
                                    "__deferred": {
                                        "type": "object",
                                        "properties": {
                                            "uri": {
                                                "type": "string"
                                            }
                                        }
                                    }
                                }
                            },
                            "Resource": {
                                "type": "object",
                                "properties": {
                                    "__deferred": {
                                        "type": "object",
                                        "properties": {
                                            "uri": {
                                                "type": "string"
                                            }
                                        }
                                    }
                                }
                            },
                            "Task": {
                                "type": "object",
                                "properties": {
                                    "__deferred": {
                                        "type": "object",
                                        "properties": {
                                            "uri": {
                                                "type": "string"
                                            }
                                        }
                                    }
                                }
                            },
                            "ActualCostWorkPerformed": {
                                "type": "integer"
                            },
                            "ActualOvertimeCost": {
                                "type": "integer"
                            },
                            "BaselineCost": {
                                "type": "integer"
                            },
                            "BaselineCostPerUse": {
                                "type": "integer"
                            },
                            "BaselineFinish": {
                                "type": "string"
                            },
                            "BaselineStart": {
                                "type": "string"
                            },
                            "BaselineWork": {},
                            "BaselineWorkMilliseconds": {
                                "type": "integer"
                            },
                            "BaselineWorkTimeSpan": {
                                "type": "string"
                            },
                            "BudgetedCostWorkPerformed": {
                                "type": "integer"
                            },
                            "BudgetedCostWorkScheduled": {
                                "type": "integer"
                            },
                            "CostVariance": {
                                "type": "integer"
                            },
                            "CostVarianceAtCompletion": {
                                "type": "integer"
                            },
                            "Created": {
                                "type": "string"
                            },
                            "CurrentCostVariance": {
                                "type": "integer"
                            },
                            "Finish": {
                                "type": "string"
                            },
                            "FinishVariance": {
                                "type": "string"
                            },
                            "FinishVarianceMilliseconds": {
                                "type": "integer"
                            },
                            "FinishVarianceTimeSpan": {
                                "type": "string"
                            },
                            "Id": {
                                "type": "string"
                            },
                            "IsConfirmed": {
                                "type": "boolean"
                            },
                            "IsOverAllocated": {
                                "type": "boolean"
                            },
                            "IsPublished": {
                                "type": "boolean"
                            },
                            "IsResponsePending": {
                                "type": "boolean"
                            },
                            "IsUpdateNeeded": {
                                "type": "boolean"
                            },
                            "LevelingDelay": {
                                "type": "string"
                            },
                            "LevelingDelayMilliseconds": {
                                "type": "integer"
                            },
                            "LevelingDelayTimeSpan": {
                                "type": "string"
                            },
                            "Modified": {
                                "type": "string"
                            },
                            "Notes": {},
                            "OvertimeCost": {
                                "type": "integer"
                            },
                            "RemainingCost": {
                                "type": "integer"
                            },
                            "RemainingOvertimeCost": {
                                "type": "integer"
                            },
                            "Resume": {
                                "type": "string"
                            },
                            "ScheduleCostVariance": {
                                "type": "integer"
                            },
                            "Start": {
                                "type": "string"
                            },
                            "StartVariance": {
                                "type": "string"
                            },
                            "StartVarianceMilliseconds": {
                                "type": "integer"
                            },
                            "StartVarianceTimeSpan": {
                                "type": "string"
                            },
                            "Stop": {
                                "type": "string"
                            },
                            "WorkContourType": {
                                "type": "integer"
                            },
                            "WorkVariance": {
                                "type": "string"
                            },
                            "WorkVarianceMilliseconds": {
                                "type": "integer"
                            },
                            "WorkVarianceTimeSpan": {
                                "type": "string"
                            },
                            "ActualCost": {
                                "type": "integer"
                            },
                            "ActualFinish": {
                                "type": "string"
                            },
                            "ActualOvertimeWork": {
                                "type": "string"
                            },
                            "ActualOvertimeWorkMilliseconds": {
                                "type": "integer"
                            },
                            "ActualOvertimeWorkTimeSpan": {
                                "type": "string"
                            },
                            "ActualStart": {
                                "type": "string"
                            },
                            "ActualWork": {
                                "type": "string"
                            },
                            "ActualWorkMilliseconds": {
                                "type": "integer"
                            },
                            "ActualWorkTimeSpan": {
                                "type": "string"
                            },
                            "BudgetedCost": {
                                "type": "integer"
                            },
                            "BudgetedWork": {
                                "type": "string"
                            },
                            "BudgetedWorkMilliseconds": {
                                "type": "integer"
                            },
                            "BudgetedWorkTimeSpan": {
                                "type": "string"
                            },
                            "Cost": {
                                "type": "integer"
                            },
                            "CostRateTable": {
                                "type": "integer"
                            },
                            "DefaultBookingType": {
                                "type": "integer"
                            },
                            "Delay": {
                                "type": "string"
                            },
                            "DelayMilliseconds": {
                                "type": "integer"
                            },
                            "DelayTimeSpan": {
                                "type": "string"
                            },
                            "IsLockedByManager": {
                                "type": "boolean"
                            },
                            "IsWorkResource": {
                                "type": "boolean"
                            },
                            "OvertimeWork": {
                                "type": "string"
                            },
                            "OvertimeWorkMilliseconds": {
                                "type": "integer"
                            },
                            "OvertimeWorkTimeSpan": {
                                "type": "string"
                            },
                            "PercentWorkComplete": {
                                "type": "integer"
                            },
                            "RegularWork": {
                                "type": "string"
                            },
                            "RegularWorkMilliseconds": {
                                "type": "integer"
                            },
                            "RegularWorkTimeSpan": {
                                "type": "string"
                            },
                            "RemainingOvertimeWork": {
                                "type": "string"
                            },
                            "RemainingOvertimeWorkMilliseconds": {
                                "type": "integer"
                            },
                            "RemainingOvertimeWorkTimeSpan": {
                                "type": "string"
                            },
                            "RemainingWork": {
                                "type": "string"
                            },
                            "RemainingWorkMilliseconds": {
                                "type": "integer"
                            },
                            "RemainingWorkTimeSpan": {
                                "type": "string"
                            },
                            "ResourceCapacity": {
                                "type": [
                                    "integer",
                                    "number"
                                ]
                            },
                            "Work": {
                                "type": "string"
                            },
                            "WorkMilliseconds": {
                                "type": "integer"
                            },
                            "WorkTimeSpan": {
                                "type": "string"
                            }
                        },
                        "required": [
                            "__metadata",
                            "CustomFields",
                            "Owner",
                            "Parent",
                            "Resource",
                            "Task",
                            "ActualCostWorkPerformed",
                            "ActualOvertimeCost",
                            "BaselineCost",
                            "BaselineCostPerUse",
                            "BaselineFinish",
                            "BaselineStart",
                            "BaselineWork",
                            "BaselineWorkMilliseconds",
                            "BaselineWorkTimeSpan",
                            "BudgetedCostWorkPerformed",
                            "BudgetedCostWorkScheduled",
                            "CostVariance",
                            "CostVarianceAtCompletion",
                            "Created",
                            "CurrentCostVariance",
                            "Finish",
                            "FinishVariance",
                            "FinishVarianceMilliseconds",
                            "FinishVarianceTimeSpan",
                            "Id",
                            "IsConfirmed",
                            "IsOverAllocated",
                            "IsPublished",
                            "IsResponsePending",
                            "IsUpdateNeeded",
                            "LevelingDelay",
                            "LevelingDelayMilliseconds",
                            "LevelingDelayTimeSpan",
                            "Modified",
                            "Notes",
                            "OvertimeCost",
                            "RemainingCost",
                            "RemainingOvertimeCost",
                            "Resume",
                            "ScheduleCostVariance",
                            "Start",
                            "StartVariance",
                            "StartVarianceMilliseconds",
                            "StartVarianceTimeSpan",
                            "Stop",
                            "WorkContourType",
                            "WorkVariance",
                            "WorkVarianceMilliseconds",
                            "WorkVarianceTimeSpan",
                            "ActualCost",
                            "ActualFinish",
                            "ActualOvertimeWork",
                            "ActualOvertimeWorkMilliseconds",
                            "ActualOvertimeWorkTimeSpan",
                            "ActualStart",
                            "ActualWork",
                            "ActualWorkMilliseconds",
                            "ActualWorkTimeSpan",
                            "BudgetedCost",
                            "BudgetedWork",
                            "BudgetedWorkMilliseconds",
                            "BudgetedWorkTimeSpan",
                            "Cost",
                            "CostRateTable",
                            "DefaultBookingType",
                            "Delay",
                            "DelayMilliseconds",
                            "DelayTimeSpan",
                            "IsLockedByManager",
                            "IsWorkResource",
                            "OvertimeWork",
                            "OvertimeWorkMilliseconds",
                            "OvertimeWorkTimeSpan",
                            "PercentWorkComplete",
                            "RegularWork",
                            "RegularWorkMilliseconds",
                            "RegularWorkTimeSpan",
                            "RemainingOvertimeWork",
                            "RemainingOvertimeWorkMilliseconds",
                            "RemainingOvertimeWorkTimeSpan",
                            "RemainingWork",
                            "RemainingWorkMilliseconds",
                            "RemainingWorkTimeSpan",
                            "ResourceCapacity",
                            "Work",
                            "WorkMilliseconds",
                            "WorkTimeSpan"
                        ]
                    }
                }
            }
        }
    }
}

然后你编写解析的结果 JSON

@{body('Parse_JSON')?['d']?['results']}

现在将 AssignmentId 设置为...

@{outputs('Compose_2')?[0]?['Id']}

现在创建条件。如果 AssignmentId 不等于空白,则...

SetAssignedTo 值为

@{outputs('Compose')?['d']?['Name']}

我相信他们是一种更简洁的方法,但至少我可以提取资源名称(又名 AssignedTo)