How to get the unique Device in Windows Store App (Metro App)?
Can we use:
Windows.System.Profile.HardwareIdentification.GetPackageSpecificToken(null);
Windows.System.Profile.HardwareToken hToke = Windows.System.Profile.HardwareIdentification.GetPackageSpecificToken(null);
IBuffer hardwareId = hToke.Id;
IBuffer signature = hToke.Signature;
IBuffer certificate = hToke.Certificate;
DataReader reader = Windows.Storage.Streams.DataReader.FromBuffer(hardwareId);
byte[] ar = new Byte[hardwareId.Length];
reader.ReadBytes(ar);
string i = ar.ToString();
string id = System.Text.Encoding.Unicode.GetString(ar, 0, ar.Length);
System.Diagnostics.Debug.WriteLine("ID" + Convert.ToBase64String(ar));
Network adapter Id of first Network adapter found
IReadOnlyCollection<Windows.Networking.Connectivity.ConnectionProfile> profiles =
Windows.Networking.Connectivity.NetworkInformation.GetConnectionProfiles();
Windows.Networking.Connectivity.NetworkAdapter na = profiles.First<Windows.Networking.Connectivity.ConnectionProfile>().NetworkAdapter;
string nid = na.NetworkAdapterId.ToString();
Yes, this is a suggested way:
private string GetHardwareId()
{
var token = HardwareIdentification.GetPackageSpecificToken(null);
var hardwareId = token.Id;
var dataReader = Windows.Storage.Streams.DataReader.FromBuffer(hardwareId);
byte[] bytes = new byte[hardwareId.Length];
dataReader.ReadBytes(bytes);
return BitConverter.ToString(bytes);
}
Or, you have problems with this method?
Here is an other way I found:
Windows.Security.ExchangeActiveSyncProvisioning.EasClientDeviceInformation deviceInfo =
new Windows.Security.ExchangeActiveSyncProvisioning.EasClientDeviceInformation();
var myDeviceID = deviceInfo.Id;
Related
When I use iText 7 for .NET to read a PDF file encrypted using a certificate and inspect the permissions, the GetPermissions() method returns 0.
Package version: 7.2.1
Operating system: Windows 10
Here is the code that I use to encrypt an existing PDF file:
using var inputPdfReader = PdfReaderFactory.CreatePdfReader("plain.pdf");
using var outputStream = new FileStream("encrypted.pdf", FileMode.Create);
var certificate = new X509Certificate2("mycert.pfx", "secret", X509KeyStorageFlags.Exportable);
var writerProperties = new WriterProperties()
.SetPublicKeyEncryption(
new[] { DotNetUtilities.FromX509Certificate(certificate) },
new[] { EncryptionConstants.ALLOW_COPY | EncryptionConstants.ALLOW_DEGRADED_PRINTING },
Encryption);
using var pdfWriter = new PdfWriter(outputStream, writerProperties);
using var outputPdfDocument = new PdfDocument(inputPdfReader, pdfWriter);
As long as the certificate is installed in my certificate store I can open the PDF using Acrobat Reader, and it displays the expected permissions:
However, when I read this PDF using iText 7, the permissions come back as 0:
var certificate = new X509Certificate2("mycert.pfx", "secret", X509KeyStorageFlags.Exportable);
if (!certificate.HasPrivateKey)
{
throw new NotSupportedException("Certificate must have a private key.");
}
var bouncyCertificate = DotNetUtilities.FromX509Certificate(certificate);
var keyPair = DotNetUtilities.GetKeyPair(certificate.GetRSAPrivateKey());
var readerProperties = new ReaderProperties()
.SetPublicKeySecurityParams(bouncyCertificate, keyPair.Private);
using var pdfReader = new PdfReader("encrypted.pdf", readerProperties);
using var pdfDocument = new PdfDocument(pdfReader);
int permissions = (int)pdfReader.GetPermissions();
// permissions == 0
This looks like a bug in iText 7. Am I missing something?
Trying to use a resource image:
var builder = new BodyBuilder();
var image =
builder.LinkedResources.Add("pack://application:,,,/Resources/LOGO_275.png");
image.ContentId = MimeUtils.GenerateMessageId();
but needs a string (filename:)
How can i use a resource image ?
Kind Regards
Johan
var builder = new BodyBuilder();
using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("LOGO_275.png")) {
var image = builder.LinkedResources.Add("LOGO_275.png", stream);
image.ContentId = MimeUtils.GenerateMessageId();
}
The Add() methods that take a string filename and a Stream only use the filename string to figure out the MIME-Type and set the filename property of the attachment.
I had to use NameSpace.Resources.Resource.ext otherwise GetManifestResourceStream() returned null
using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("WPF_Bestelbons.Resources.LOGO_275.png"))
``code` DocuSignTK.Recipient recipient = new DocuSignTK.Recipient();
recipient.Email = signer_email; // This person will use embedded signing. If you have his
// email, supply it. If you don't, use a fake email that includes your
// ClientUserID. Eg embedded_signer_{ClientUserID}#your_company.com
recipient.UserName = signer_name;
recipient.ID = 1;
recipient.Type_x = 'Signer';
recipient.RoutingOrder = 1;
recipient.RoleName = 'Signer1';
// We want this signer to be "captive" so we can use embedded signing with him
recipient.CaptiveInfo = new DocuSignTK.RecipientCaptiveInfo();
recipient.CaptiveInfo.ClientUserID = signer_user_id; // Must uniquely identify the
// Create the recipient information
DocuSignTK.ArrayOfRecipient1 recipients = new DocuSignTK.ArrayOfRecipient1();
recipients.Recipient = new DocuSignTK.Recipient[1];
recipients.Recipient[0] = recipient;
DocuSignTK.ArrayOfTemplateReferenceRoleAssignment Roles = new DocuSignTK.ArrayOfTemplateReferenceRoleAssignment();
Roles.RoleAssignment = new DocuSignTK.TemplateReferenceRoleAssignment[1];
DocuSignTK.TemplateReferenceRoleAssignment role = new DocuSignTK.TemplateReferenceRoleAssignment();
role.RoleName = 'Signer1';
role.RecipientID = 1;
Roles.RoleAssignment[0] = role;
// Create the template reference from a server-side template ID
DocuSignTK.TemplateReference templateReference = new DocuSignTK.TemplateReference();
templateReference.Template = 'd0d80082-612b-4a04-b2a1-0672eb720491';
templateReference.TemplateLocation = 'Server';
templateReference.RoleAssignments = Roles;
// Construct the envelope information
DocuSignTK.EnvelopeInformation envelopeInfo = new DocuSignTK.EnvelopeInformation();
envelopeInfo.AccountId = account_Id;
envelopeInfo.Subject = 'Subject';
envelopeInfo.EmailBlurb = 'Email content';
// Make the call
try {
//DocuSignTK.EnvelopeStatus result = api_sender.CreateAndSendEnvelope(envelope);
// Create draft with all the template information
DocuSignTK.ArrayOfTemplateReference TemplateReferenceArray = new DocuSignTK.ArrayOfTemplateReference();
TemplateReferenceArray.TemplateReference = new DocuSignTK.TemplateReference[1];
TemplateReferenceArray.TemplateReference[0] = templateReference;
DocuSignTK.EnvelopeStatus result = api_sender.CreateEnvelopeFromTemplates( TemplateReferenceArray, recipients, envelopeInfo, true);
envelope_id = result.EnvelopeID;
System.debug('Returned successfully, envelope_id = ' + envelope_id );
} catch ( CalloutException e) {
System.debug('Exception - ' + e );
error_code = 'Problem: ' + e;
error_message = error_code;
} `code``
I am integrating Docusign for embedded signing. I am using SOAP API and used method CreateEnvelopeFromTemplates . Template I created is having some fields/Tabs. But once I open signing url these fields are located on side of the document instead of the location which I sent in template.
I have also assigned Role name for recipient but it is not working. Please help.
Click here to see screenshot
Here is the C# code to create an envelope from template using the DocuSign SOAP Api. Documentation here
string apiUrl = "https://demo.docusign.net/api/3.0/api.asmx";
string accountId = "Enter accountId"; //
string email = "Enter email";
string userName = "Enter intergrator key";
userName += email;
string _password = "Enter password";
var apiClient = new DocuSignTK.APIServiceSoapClient("APIServiceSoap", apiUrl);
apiClient.ClientCredentials.UserName.UserName = userName;
apiClient.ClientCredentials.UserName.Password = _password;
// Construct all the recipient information
var recipients = new DocuSignTK.Recipient[1];
recipients[0] = new DocuSignTK.Recipient();
recipients[0].Email = "recipientone#acme.com";
recipients[0].UserName = "recipient one";
recipients[0].Type = DocuSignTK.RecipientTypeCode.Signer;
recipients[0].ID = "1";
recipients[0].RoutingOrder = 1;
recipients[0].RoleName = "Signer1";
var roles = new DocuSignTK.TemplateReferenceRoleAssignment[1];
roles[0] = new DocuSignTK.TemplateReferenceRoleAssignment();
roles[0].RoleName = recipients[0].RoleName;
roles[0].RecipientID = recipients[0].ID;
// Use a server-side template -- you could make more than one of these
var templateReference = new DocuSignTK.TemplateReference();
templateReference.TemplateLocation = DocuSignTK.TemplateLocationCode.Server;
// TODO: replace with template ID from your account
templateReference.Template = "d0d80082-612b-4a04-b2a1-0672eb720491";
templateReference.RoleAssignments = roles;
// Construct the envelope information
DocuSignTK.EnvelopeInformation envelopeInfo = new DocuSignTK.EnvelopeInformation();
envelopeInfo.AccountId = " ";
envelopeInfo.Subject = "create envelope from templates test";
envelopeInfo.EmailBlurb = "testing docusign creation services";
// Create draft with all the template information
DocuSignTK.EnvelopeStatus status = apiClient.CreateEnvelopeFromTemplates(new DocuSignTK.TemplateReference[] { templateReference },
recipients, envelopeInfo, false);
I downloaded a template from production and uploaded in sandbox but once I recreated similar template in Sandbox only and used it's template ID in code then it is working perfectly. Apparently, There seems to be some issue with import template utility of Docusign.
I'm facing an issue with Mirthconnect.
I just have a trouble in this process. I like to read the data from mail, is it possible to acheive this in the open source mirthconnect? of version 3.3.1, if so is it possible to read from direct mail?. Apart from the commerical versions like mirth mails.
I made use of JAVA mail library and inserted it in the custom library folder of mirth connect then used the following code in the connector portion of mirth. It works well.
//Fetchmail from Gmail
var props = new Packages.java.util.Properties();
props.setProperty("mail.store.protocol", "imaps");
var session = new Packages.javax.mail.Session.getInstance(props, null);
var store = session.getStore();
store.connect("imap.gmail.com", "xxxxxxxx#gmail.com", "xxxxxxxxx");
var inbox = store.getFolder("INBOX");
inbox.open(Packages.javax.mail.Folder.READ_ONLY);
var msgs = inbox.getMessage(inbox.getMessageCount());
var currentMessage = inbox.getMessage(inbox.getMessageCount());
var mp = currentMessage.getContent();
var bp = mp.getBodyPart(0);
var content = "" + bp.getContent();
content = content.replace(/''/g, "");
globalMap.put('gcon', content);
logger.info("SENT DATE:" + msgs.getSentDate());
logger.info("SUBJECT:" + msgs.getSubject());
logger.info("CONTENT:" + content);
//bp.getContent()
var receiveId = UUIDGenerator.getUUID();
logger.info("incomingMailID : "+receiveId);
//Database Connectivity
var time= msgs.getSentDate();
var con = bp.getContent();
var sub = msgs.getSubject();
//global variable declaration
globalMap.put('glcontent',con);
globalMap.put('glsubject',sub);
globalMap.put('gltime',time);
return sub;
Then you can set the the polling frequency time intervalin the listener which the mirth channel will poll for that specific time interval.
Anyone help me..
var addresses = [4];
addresses[0] = new ContactAddress('streetAddress','Die Strasse 45',true);
addresses[1] = new ContactAddress('locality','Hamburg',true);
addresses[2] = new ContactAddress('postalCode','22041',true);
addresses[3] = new ContactAddress('country','Deutschland',true);
myContact.addresses = addresses;
Above is the code i am trying to add contact address to iOS using Phonegap. But the address not added to Addressbook, rest like Name, phonenumbers are updated properly.
Looking forward to the solution.
In PhoneGap, the addresses array contains several addresses, not several address-details.
To add your address, try :
addresses[0] = new ContactAddress();
addresses[0].streetAddress = 'yourStreet';
addresses[0].locality = 'yourLocality';
addresses[0].postalCode = 'yourPostalCode';
addresses[0].country = 'yourCountry';
Try This:
var addresses = [1];
var address = new ContactAddress();
address.streetAddress='MyAddress';
address.locality='MyLocality';
address.postalCode='MyPostCode';
address.country='MyCountry';
addresses[0] = address;
contact.addresses = addresses;
Thanks Vinayak.
I got the solution, problem with iOS not phonegap and below is the working code.The type property required for adding contactAddress in iOS addressbook.
var addresses= [];
addresses[0] = new ContactAddress();
**addresses[0].type = 'home';**
addresses[0].streetAddress = 'yourStreet';
addresses[0].locality = 'yourLocality';
addresses[0].postalCode = 'yourPostalCode';
addresses[0].country = 'yourCountry';
myContact.addresses = addresses;