> ## Documentation Index
> Fetch the complete documentation index at: https://docs.superoffice.com/llms.txt
> Use this file to discover all available pages before exploring further.

# SuperOffice.WebApi.Agents.INewsFeedAgent

# \<a id="SuperOffice\_WebApi\_Agents\_INewsFeedAgent">\</a> Interface INewsFeedAgent

Namespace: [SuperOffice.WebApi.Agents](SuperOffice.WebApi.Agents.md)\
Assembly: SuperOffice.WebApi.dll

Posting and reading Newsfeed items, marking them as read or as handled.

```csharp theme={null}
public interface INewsFeedAgent : IAgentBase, IDisposable
```

#### Implements

[IAgentBase](SuperOffice.WebApi.Agents.IAgentBase.md),
[IDisposable](https://learn.microsoft.com/dotnet/api/system.idisposable)

## Methods

### \<a id="SuperOffice\_WebApi\_Agents\_INewsFeedAgent\_CreateDefaultNewsFeedItemAsync\_SuperOffice\_WebApi\_RequestOptions\_">\</a> CreateDefaultNewsFeedItemAsync(RequestOptions)

Set default values into a new NewsFeedItem.
NetServer calculates default values on the entity, which is required when creating/storing a new instance

```csharp theme={null}
Task<NewsFeedItem> CreateDefaultNewsFeedItemAsync(RequestOptions requestOptions = null)
```

#### Parameters

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[NewsFeedItem](SuperOffice.WebApi.Data.NewsFeedItem.md)\&gt;

A blank NewsFeedItem

### \<a id="SuperOffice\_WebApi\_Agents\_INewsFeedAgent\_DeleteNewsFeedItemAsync\_System\_Int32\_SuperOffice\_WebApi\_RequestOptions\_">\</a> DeleteNewsFeedItemAsync(int, RequestOptions)

Deletes the NewsFeedItem

```csharp theme={null}
Task DeleteNewsFeedItemAsync(int newsFeedItemId, RequestOptions requestOptions = null)
```

#### Parameters

`newsFeedItemId` [int](https://learn.microsoft.com/dotnet/api/system.int32)

The identity of the NewsFeedItem

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task)

### \<a id="SuperOffice\_WebApi\_Agents\_INewsFeedAgent\_GetNewsFeedItemAsync\_System\_Int32\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetNewsFeedItemAsync(int, RequestOptions)

Gets a specific NewsFeedItem object.

```csharp theme={null}
Task<NewsFeedItem> GetNewsFeedItemAsync(int newsFeedItemId, RequestOptions requestOptions = null)
```

#### Parameters

`newsFeedItemId` [int](https://learn.microsoft.com/dotnet/api/system.int32)

The identifier of the NewsFeedItem object

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[NewsFeedItem](SuperOffice.WebApi.Data.NewsFeedItem.md)\&gt;

NewsFeedItem

### \<a id="SuperOffice\_WebApi\_Agents\_INewsFeedAgent\_GetNewsFeedItemsByIdAsync\_System\_Int32\_\_\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetNewsFeedItemsByIdAsync(int\[], RequestOptions)

Get an array of items from the newsfeed by id. If the current user cannot access a particular item, it will be excluded from the results.

```csharp theme={null}
Task<NewsFeedItem[]> GetNewsFeedItemsByIdAsync(int[] newsFeedItemIds, RequestOptions requestOptions = null)
```

#### Parameters

`newsFeedItemIds` [int](https://learn.microsoft.com/dotnet/api/system.int32)\[]

Ids of the news feed items to mark as seen for this user.

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[NewsFeedItem](SuperOffice.WebApi.Data.NewsFeedItem.md)\[]\&gt;

The news feed items that was posted, or null if not found/not accessible by the user.

### \<a id="SuperOffice\_WebApi\_Agents\_INewsFeedAgent\_GetNewsItemsForUserAsync\_System\_Int32\_System\_DateTime\_System\_DateTime\_System\_Int32\_System\_Int32\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetNewsItemsForUserAsync(int, DateTime, DateTime, int, int, RequestOptions)

Get a list of newsfeed items for a particular user between two dates. If the current user cannot access a particular item, it will be excluded from the results.

```csharp theme={null}
Task<NewsFeedItem[]> GetNewsItemsForUserAsync(int associateId, DateTime fromDate, DateTime toDate, int top, int skip, RequestOptions requestOptions = null)
```

#### Parameters

`associateId` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Id of the associate to fetch news feed items for. 0 = current user

`fromDate` [DateTime](https://learn.microsoft.com/dotnet/api/system.datetime)

Start date for fetching news feed items.

`toDate` [DateTime](https://learn.microsoft.com/dotnet/api/system.datetime)

End date for fetching news feed items.

`top` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Maximum number of news feed items to return.

`skip` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Number of news feed items to skip for paging.

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[NewsFeedItem](SuperOffice.WebApi.Data.NewsFeedItem.md)\[]\&gt;

The news feed items that was posted, or null if not found/not accessible by the user.

### \<a id="SuperOffice\_WebApi\_Agents\_INewsFeedAgent\_MarkAsHandledAsync\_System\_Int32\_SuperOffice\_WebApi\_RequestOptions\_">\</a> MarkAsHandledAsync(int, RequestOptions)

Marks the news feed item as handled, so it can be removed from the feed.

```csharp theme={null}
Task<bool> MarkAsHandledAsync(int newsFeedItemId, RequestOptions requestOptions = null)
```

#### Parameters

`newsFeedItemId` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Id of the news feed item to mark as handled for all users.

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[bool](https://learn.microsoft.com/dotnet/api/system.boolean)\&gt;

Indicates if the news feed item was successfully marked as handled. False if it was already handled.

### \<a id="SuperOffice\_WebApi\_Agents\_INewsFeedAgent\_MarkAsReadAsync\_System\_Int32\_SuperOffice\_WebApi\_RequestOptions\_">\</a> MarkAsReadAsync(int, RequestOptions)

Marks the news feed item as read, so it can be un-bolded in the current user's feed.

```csharp theme={null}
Task MarkAsReadAsync(int newsFeedItemId, RequestOptions requestOptions = null)
```

#### Parameters

`newsFeedItemId` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Id of the news feed item to mark as seen for this user.

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task)

This method has no return value

### \<a id="SuperOffice\_WebApi\_Agents\_INewsFeedAgent\_PostNewsFeedItemAsync\_SuperOffice\_WebApi\_Data\_NewsFeedItem\_System\_Int32\_\_\_System\_Int32\_\_\_System\_Boolean\_SuperOffice\_WebApi\_RequestOptions\_">\</a> PostNewsFeedItemAsync(NewsFeedItem, int\[], int\[], bool, RequestOptions)

Saves a new item to the newsfeed, publishing it to the specified users.

```csharp theme={null}
Task<NewsFeedItem> PostNewsFeedItemAsync(NewsFeedItem newsFeedItem, int[] toAssociateIds, int[] toGroupIds, bool toAll, RequestOptions requestOptions = null)
```

#### Parameters

`newsFeedItem` [NewsFeedItem](SuperOffice.WebApi.Data.NewsFeedItem.md)

The news feed item to post. NewsFeedItemId is ignored, as a new id will be generated when posting to the newsfeed.

`toAssociateIds` [int](https://learn.microsoft.com/dotnet/api/system.int32)\[]

List of associate ids that this news feed item is sent to.

`toGroupIds` [int](https://learn.microsoft.com/dotnet/api/system.int32)\[]

List of group ids that this news feed item is sent to. This gets resolved to associate ids when posted.

`toAll` [bool](https://learn.microsoft.com/dotnet/api/system.boolean)

Indicates if this news feed item is sent to all users. Gets resolved into all users when posted.

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[NewsFeedItem](SuperOffice.WebApi.Data.NewsFeedItem.md)\&gt;

The news feed item that was posted, including its new id.

### \<a id="SuperOffice\_WebApi\_Agents\_INewsFeedAgent\_StartHandlingAsync\_System\_Int32\_SuperOffice\_WebApi\_RequestOptions\_">\</a> StartHandlingAsync(int, RequestOptions)

Marks the news feed item as being handled, that CTA processing has started. i.e. other users should not start handling it also.

```csharp theme={null}
Task<bool> StartHandlingAsync(int newsFeedItemId, RequestOptions requestOptions = null)
```

#### Parameters

`newsFeedItemId` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Id of the news feed item to mark as handled for all users.

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[bool](https://learn.microsoft.com/dotnet/api/system.boolean)\&gt;

Indicates if the news feed item was successfully marked as being handled. False if it was already being handled or was handled.


## Related topics

- [SuperOffice.WebApi.Agents.NewsFeedAgent](/en/api/reference/webapi/SuperOffice.WebApi.Agents.NewsFeedAgent.md)
- [SuperOffice.WebApi.Data.NewsFeedItem](/en/api/reference/webapi/SuperOffice.WebApi.Data.NewsFeedItem.md)
- [SuperOffice.WebApi.Data.NewsFeedCTA](/en/api/reference/webapi/SuperOffice.WebApi.Data.NewsFeedCTA.md)
- [SuperOffice.WebApi.Data.NewsFeed PostNewsFeedItemRequest](/en/api/reference/webapi/SuperOffice.WebApi.Data.NewsFeed_PostNewsFeedItemRequest.md)
- [SuperOffice.WebApi.Data.NewsFeed GetNewsFeedItemsByIdRequest](/en/api/reference/webapi/SuperOffice.WebApi.Data.NewsFeed_GetNewsFeedItemsByIdRequest.md)
- [SuperOffice.WebApi.Data.NewsFeedItemStatus](/en/api/reference/webapi/SuperOffice.WebApi.Data.NewsFeedItemStatus.md)
