I created a template within my DocuSign developer Sandbox that contains one document. I'm using the C# SDK to try and send out an envelope to a user, based on a template.
Here's the code where I retrieve all of the templates.
TemplatesApi templateApi = new TemplatesApi(ApiClient.Configuration);
EnvelopeTemplateResults templateResults = templateApi.ListTemplates(AccountID);
The issue I am having is the EnvelopeTemplateResults does NOT have any documents associated with it.
When I use the REST API using POSTMAN, performing a GET to this URL, I can see that there's an envelopeTemplateDefinition, that has a Document on it, which is the one I want.
My question is, how, using the SDK API, can I get the envelopeTemplateDefinition ?
In order to have the ListTemplates method include the Documents info, you have to set an Include parameter:
var templatesApi = new TemplatesApi(apiClient.Configuration);
var listTemplatesOptions = new TemplatesApi.ListTemplatesOptions { include = "documents" };
var templateResults = templatesApi.ListTemplates(accountId, listTemplatesOptions);
If you are trying to get the Template Definition of a single template, the templatesApi.Get() method can be used with its own set of Include options:
var getTemplateOptions = new TemplatesApi.GetOptions { include = "documents" };
var templateDefinition = templatesApi.Get(accountId, templateId, getTemplateOptions);
Finally, if you're trying to get an actual PDF out of a specific template, that would be the templatesApi.GetDocument() method:
templatesApi.GetDocument(accountId, templateId, documentId);
Where DocumentId is the specific document you want to pull, or "Combined" if you want to pull all the documents in as a single PDF.
Chris, if you are using the v2 API, there's an endpoint:
GET /v2/accounts/{accountId}/templates/{templateId}/documents/{documentId}
you can try it here - https://apiexplorer.docusign.com/#/esign/restapi?categories=Templates&tags=TemplateDocuments&operations=get
the c# SDK inside TemplateAPI has GetDocument() and UpdateDocument() methods
Related
In an older JavaScript app I used keyword-query to search for document properties, and I could add the 'DlcDocID' field (Document id) to be retrieved.
I am currently developing an Spfx version of the app, and use pnp.sp.search to get document data. This way I can get the UniqueId and the DocId, but not the Document Id. How can I have this parameter included in the search results?
Extra:
I am using 1.3.11, and this code
pnp.sp.search(
{
Querytext:query,
RowLimit:rows,
StartRow:start,
SelectProperties: ["DocId"
, "UniqueId"
,"FileType"
,"ServerRedirectedEmbedURL"
, "ServerRedirectedPreviewURL"
,"LastModifiedTime"
,"Write"
,"Size"
,"SPWebUrl"
,"ParentLink"
,"Title"
,"HitHighlightedSummary"
,"Path"
,"Author"
,"LastModifiedTime"
,"DlcDocID"
],
But DlcDocID is never retrieved.
Looking at the docs, DlcDocID should be retrievable (it's queryable and retrievable by default). Have you tried using SearchQueryBuilder and selectProperties?
const q = SearchQueryBuilder().text(yourQuery).
.rowLimit(10).processPersonalFavorites.selectProperties('*', 'DlcDocID');
const results = await sp.search(q);
SearchQueryBuilder reference
The issue was that the pnp
SearchResult interface didn't have the DlcDocID in this version. Adding it solved the problem.
Each envelope type will have its own email subject/body that is static for that envelope type. Here is an example of a few predetermined envelope types:
Mortgage closing documents
Mortgage loan application documents
These envelopes will contain a varied number of documents and each document is unique. I've attempted to create a template without a document, but it appears that is not allowed.
I'd like to be able to save the email body and subject for these envelope types so that when I send an envelope via the DocuSign API, I don't have to directly specify these fields. I'm hoping to avoid storing the subject/body inside of code or a configuration file. Preferably, I'd like a non-technical person to be able to change the subject/body through the DocuSign interface.
What I ended up doing:
Based on Kim Brandl's recommendations, I wrote the following code which worked as expected. A few notes:
The initial file that you added to the template will not appear in the final envelope if the ServerTemplate sequence is greater than the InlineTemplate. You can read more here.
The Recipients, signers, documents, etc., follow the same pattern as a standard EnvelopeDefinition except the data is placed under the InlineTemplate.
string docBase64 = Convert.ToBase64String(file.Stream.ReadAsBytes());
EnvelopeDefinition envDef = New EnvelopeDefinition();
envDef.Status = "created";
// The first sequence that appears will be the first document that is applied.
// If you want the uploaded documents to appear instead of the server template,
// make the server template a higher number.
envDef.CompositeTemplates = new List<CompositeTemplate>
{
new CompositeTemplate()
{
ServerTemplates = new List<ServerTemplate>()
{
new ServerTemplate("2", templateId)
},
InlineTemplates = new List<InlineTemplate>()
{
new InlineTemplate()
{
Sequence = "1",
Recipients = new Recipients()
{
Signers = new List<Signer>()
{
new Signer()
{
Email = request.Recipients[0].UserEmail,
Name = request.Recipients[0].UserName,
RoleName = request.Recipients[0].RoleName,
RecipientId = (1).ToString()
}
}
},
Documents = new List<Document>()
{
new Document()
{
DocumentBase64 = docBase64,
DocumentId = "3",
Name = "ConsentFake.pdf",
IncludeInDownload = "true"
},
new Document
{
DocumentBase64 = docBase64,
DocumentId = "9",
Name = "ConsentFake2.pdf",
IncludeInDownload = "true"
}
}
}
}
}
};
Summary: This allowed me to take advantage of a DocuSign template's email subject/body without having to use a specific template document.
You can implement a solution for the scenario that you've described by doing the following:
Using the DocuSign web UI, create a Template for each 'type of Envelope' and specify the Email Subject and Body in each Template that you create. You'll also need to upload a document to the Template (DocuSign requires that you add at least one document before you can save the Template) -- but you can just add any placeholder doc (for example, a .txt file that contains the word placeholder file). The document you add to the template won't actually be used in the Envelopes that you create from the Template -- since you'll use the API to specify documents at runtime. (Non-technical folks will be able to use the DocuSign web UI to modify/update the email info in each Template at any point in the future.)
When sending an Envelope via the API, use the compositeTemplates structure in the "Create Envelope" API request. By using the compositeTemplates structure, you can specify the serverTemplate to use (which will pull in the Email Subject and Email Body that you've defined in that Template), specify recipient and tab info by using the inlineTemplate object, and specify document info using the document object.
(There's lots of info available here on Stack Overflow about how to use compositeTemplates in the Create Envelope request. If you have trouble getting that request structure correct/working, please post a separate question.)
i want to use the rest api for updating my articles with a csv file.
the manual apdate recoding to this link here works:
https://developers.shopware.com/developers-guide/rest-api/examples/batch/
but how can i load my csv file?
i only fount the links below, which are al little bit older:
https://forum.shopware.com/discussion/11727/api-artikel-import-mit-csv-datei
https://forum.shopware.com/discussion/15796/lagerbestand-abgleich-csv-mit-hilfe-von-api
$api = Shopware()->Api();
...
$data_path = $api->load("http://www.XXXXXX.de/import/test.csv";
this doesn't work in shopware 5
First of all the Rest API is an API which has to be called by URL with parameters. You cannot instanciate it within you PHP code directly. It is used if you want to have another software connect to shopware.
In you case there is another way. You can use the Resources that the API internally also uses.
$manger = new \Shopware\Components\Api\Manager();
$resource = $manger->getResource('Article');
foreach ($csvRows as $row){
// create an array for the csv > article mapping
$data = [];
$data['name'] = $row['csv_row_name'];
// do all mappings into the data array
// ....
// create the article from that array
$article = $resource->create($data);
}
In this documentation you can see which fields are required in the $data array to successfully create an article
https://developers.shopware.com/developers-guide/rest-api/api-resource-article/
My Kentico server is unable to send e-mails, so I have to transform my e-mail using MacroResolver, but send it using some other way.
var clients = new List<Client>();
var macroResolver = MacroResolver.GetInstance();
macroResolver.AddDynamicParameter("clients", clients);
var emailMessage = new EmailMessage {
From = "someone#somewhere.com",
Recipients = "otherone#somewhere.com",
Subject = "Whatever"
};
var template = EmailTemplateProvider.GetEmailTemplate(templateName, siteName);
EmailSender.SendEmailWithTemplateText(siteName, emailMessage, template, macroResolver, true);
In other words, I would like to use Kentico just as a Template Engine. Is there anyway to achieve this?
What SendEmailWithTemplateText method basically does is it fills empty fields of message by its equivalent from a template and resolve macro values in it. If you are only after message body, then you can create the email message by:
emailMessage.Body = macroResolver.ResolveMacros(emailMessage.Body);
emailMessage.PlainTextBody = macroResolver.ResolveMacros(emailMessage.PlainTextBody);
For most scenarios it's also better to tell the resolver to encode resolved values. You can do it by: resolver.EncodeResolvedValues = true;
Also you are passing whole 'clients' collection to the resolver. You'll probably need to take it one by one and generate emails in a loop.
We are working with Fast Search for Sharepoint 2010 and had some backend setup done with creating some managed properties e.g. BestBetDescription, keywords etc.
From the front-end part we are creating an application what will fetch all these properties and display in a grid.
However while querying the backend we are NOT getting these managed properties (BestBetDescription) along with other properties such as Title, URL etc.
Following is my source code:
settingsProxy = SPFarm.Local.ServiceProxies.GetValue<SearchQueryAndSiteSettingsServiceProxy>();
searchProxy = settingsProxy.ApplicationProxies.GetValue<SearchServiceApplicationProxy>("FAST Query SSA");
keywordQuery = new KeywordQuery(searchProxy);
keywordQuery.EnableFQL = true;
keywordQuery.QueryText = p;
keywordQuery.ResultsProvider = SearchProvider.FASTSearch;
keywordQuery.ResultTypes = ResultType.RelevantResults;
ResultTableCollection resultsTableCollection = keywordQuery.Execute();
ResultTable searchResultsTable = resultsTableCollection[ResultType.RelevantResults];
DataTable resultsDataTable = new DataTable();
resultsDataTable.TableName = "Results";
resultsDataTable.Load(searchResultsTable, LoadOption.OverwriteChanges);
return resultsDataTable;
The results are returned and I cannot see the Managed properties which we create in the resultDataTable.
Is there any property I missed or is this a backend issue ?
Thanks.
Hi if you are creating your custom Metadata Property then u should use this option to be selected
please check below link
http://screencast.com/t/SQdlarjhx4F
You can find this option in :
central admin:- services :- fast search :- Metadata Property :- your property
I was missing a property KeywordQuery.SelectProperties
So the code looks something like this
String[] arrSearchProperties = new String[] { "Title", "body", "url" };
KeywordQuery.SelectProperties(arrSearchProperties);
This will fetch you all the Managed Properties defined by you.