Are you looking to close your custom entity using SDK, then this post is for you. We can close ms crm custom activity type entity like other entities using SetStateRequest message. You can use below code for the same
public void CompleteTextMessage()
{
IOrganizationService _CrmService = GetCRMService(); //a function to return ms crm service object
SetStateRequest _SetStateReq = new SetStateRequest();
//provide entity details
SetStateReq.EntityMoniker = new EntityReference(“your custom entity logical name”, new Guid(“CustomEntityID”));
// Set the State and Status OptionSet Values to completed.
SetStateReq.State = new OptionSetValue(1);
SetStateReq.Status = new OptionSetValue(2);
// call execute message by passing request object
SetStateResponse _SetStateResp = (SetStateResponse)_CrmService.Execute(SetStateReq);
}