# DurableTaskGrainExtensions.TryGetTarget(DurableTask, GrainId)

[Type overview](/orleans/docs/api/csharp/microsoft.orleans.durable/orleans.durable.tasks.durabletaskgrainextensions/) | [Methods](/orleans/docs/api/csharp/microsoft.orleans.durable/orleans.durable.tasks.durabletaskgrainextensions/methods/)

[Source](https://github.com/dotnet/orleans/blob/6a0e937f544c35ffcf11b37e4c2b7de5a1580a03/src/Orleans.Durable/DurableTasks/DurableTaskGrainExtensions.cs#L34-L42)

```csharp
public static bool TryGetTarget(this DurableTask task, out GrainId target)
```

Gets the grain which a durable grain call targets, before the call is scheduled.

### Parameters

- `task` (`DurableTask`): The durable task definition.
- `target` (`GrainId`): The grain which the call targets, when this method returns `true`; otherwise `default`.

### Returns

`true` when `task` is a call to a grain's [DurableTask](/orleans/docs/api/csharp/microsoft.orleans.durable.abstractions/orleans.durable.tasks.durabletask/)-returning method, made through a grain reference and not yet scheduled; otherwise `false`, such as for a local definition like [DurableTask](/orleans/docs/api/csharp/microsoft.orleans.durable.abstractions/orleans.durable.tasks.durabletask/) or a reference to an existing task.

### Exceptions

- `System.ArgumentNullException`: `task` is `null`.
