...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
/* IMPORTANT! ** For using this example you need to uncheck the "Allow generation of asynchronous operation" option in advanced Service Reference settings*/ using System; using System.Data; using System.IO; using YourServiceReferenceHere; namespace ConsoleApp2 { class Program { public static SecurityToken GetAuth() { SecurityToken securityToken = new SecurityToken() { Username = "Student Portal", UserId = -2, DashboardAdmin = true }; return securityToken; } static void Main(string[] args) { CreateStudentDocumentRequirement(/*documentId*/, /*studentId*/); } static void CreateStudentDocumentRequirement(Int64 documentId, Int64 studentId) { using (var client = new RegentEnterpriseServiceClient()) { var record = new DocumentRequirement() { // All fields below are required documentId = documentId, documentIdSpecified = true, studentId = studentId, studentIdSpecified = true, ActivitySourceTypeCode = "SYSTEMACTION", ActivityLogEntryTypeCode = "QARelated", createdDate = DateTime.Now, createdDateSpecified = true, CreatedBy = 1, CreatedBySpecified = true, reviewedDate = DateTime.UtcNow, reviewedDateSpecified = true, receivedDate = DateTime.UtcNow, receivedDateSpecified = true, EditLockTimestamp = DateTime.UtcNow, EditLockTimestampSpecified = true, Files = new DocumentRequirementFileAttachment[] { } }; var createDRReques = new UpdateDocumentRequirementRequest { Record = record, SecurityToken = GetAuth() }; var response = client.createDocumentRequirement(createDRReques); if (response.ErrorYN) { throw new Exception(response.Message); } } } } } |
Code Block |
---|
/* IMPORTANT!
** For using this example you need to uncheck the "Allow generation of asynchronous operation" option in advanced Service Reference settings*/
using System;
using System.Data;
using System.IO;
using YourServiceReferenceHere;
namespace ConsoleApp2
{
class Program
{
public static SecurityToken GetAuth()
{
SecurityToken securityToken = new SecurityToken()
{
Username = "Student Portal",
UserId = -2,
DashboardAdmin = true
};
return securityToken;
}
static void Main(string[] args)
{
GetFileFromDocumentRequirementFileAttachmentById(/*documentRequirementIdFileAttachmentId*/, /*Target folder path*/);
}
static void GetFileFromDocumentRequirementFileAttachmentById(int documentRequirementIdFileAttachmentId, string targetFolder)
{
using (var client = new RegentEnterpriseServiceClient())
{
var request = new GetDocumentRequirementFileAttachmentRequest
{
SecurityToken = GetAuth(),
Id = documentRequirementIdFileAttachmentId,
IdSpecified = true,
};
var record = client.getDocumentRequirementFileAttachment(request).Record;
if (record.StoredFile.Length > 0)
{
File.WriteAllBytes(Path.Combine(targetFolder, record.FileName), record.StoredFile);
}
}
}
}
} |