---
title: "PMSessionSetDataInSession(_:_:_:)"
framework: applicationservices
role: symbol
role_heading: Function
path: applicationservices/1461902-pmsessionsetdatainsession
---

# PMSessionSetDataInSession(_:_:_:)

Stores your application-specific data in a printing session object.

## Declaration

```swift
func PMSessionSetDataInSession(_ printSession: PMPrintSession, _ key: CFString, _ data: CFTypeRef) -> OSStatus
```

## Parameters

- `printSession`: The printing session in which you want to store application-specific data.
- `key`: A key that uniquely identifies the data being added. This key is required to retrieve the data using the function doc://com.apple.documentation/documentation/applicationservices/1462964-pmsessiongetdatafromsession.
- `data`: The data to be stored in the printing session.

## Return Value

Return Value A result code. See Result Codes.

## Discussion

Discussion You must call this function between the creation and release of a printing session. See the function PMCreateSession(_:).

## See Also

### Accessing Data in Printing Session Objects

- [PMSessionGetDataFromSession(_:_:_:)](applicationservices/1462964-pmsessiongetdatafromsession.md)
- [PMSessionGetCurrentPrinter(_:_:)](applicationservices/1458998-pmsessiongetcurrentprinter.md)
- [PMSessionSetCurrentPMPrinter(_:_:)](applicationservices/1461096-pmsessionsetcurrentpmprinter.md)
- [PMSessionGetCGGraphicsContext(_:_:)](applicationservices/1461952-pmsessiongetcggraphicscontext.md)
- [PMSessionError(_:)](applicationservices/1460003-pmsessionerror.md)
- [PMSessionSetError(_:_:)](applicationservices/1460216-pmsessionseterror.md)
