|
And?
What have you tried?
Where are you stuck?
What help do you need?
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Hi,
I'm trying to encrypt and send emails using a c# function.
Code segment which encrypt the email as below.
if (Convert.ToString(1).Equals(encryptEmail))
{
const string PR_SECURITY_FLAGS = "http://schemas.microsoft.com/mapi/proptag/0x6E010003";
Object ulFlags = 0x3;
mailItem.PropertyAccessor.SetProperty(PR_SECURITY_FLAGS, ulFlags);
}
The mail goes out successfully as an encrypted email but the problem is it leaves a copy in drafts folder as well.
I don't have any setting to set
SaveSentMessageFolder
Any idea how to get around this?
|
|
|
|
|
A little more code & information would be nice; there really is no way to know what library you are using to create and send the mail.
|
|
|
|
|
Apologies. Here is the full code.
public static void sendMailTest(string emailSubject, string toAddress, string emailBody)
{
_outlookApplication = new Application();
_mapiNameSpace = _outlookApplication.GetNamespace("MAPI");
_outlookInbox = _mapiNameSpace.GetDefaultFolder(OlDefaultFolders.olFolderInbox);
MailItem mailItem = _outlookApplication.CreateItem(OlItemType.olMailItem);
mailItem.Subject = emailSubject;
mailItem.To = toAddress;
mailItem.Body = emailBody;
const string PR_SECURITY_FLAGS = "http://schemas.microsoft.com/mapi/proptag/0x6E010003";
Object ulFlags = 0x3;
mailItem.PropertyAccessor.SetProperty(PR_SECURITY_FLAGS, ulFlags);
mailItem.Send();
}
Please note that _outlookApplication,_mapiNameSpace and _outlookInbox are defined at class level as below
private static Application _outlookApplication;
private static NameSpace _mapiNameSpace;
private static MAPIFolder _outlookInbox;
|
|
|
|
|
|
Are you authorized to print it? You do understand that printing PAN cards at home will be an illegal activity.
"It is easy to decipher extraterrestrial signals after deciphering Javascript and VB6 themselves.", ISanti[ ^]
|
|
|
|
|
no sir actually this application built only for me for test my knowledge. just i want to check if i m able to do this.
|
|
|
|
|
Member 13123466 wrote: can i use report viewer for this. Quite possibly; if you know how to use a report generator. Alternatively you could just code it straight in C#.
|
|
|
|
|
but the background image and barcode also used in pan card then how we can put this ??
thank you
|
|
|
|
|
Sorry, I have no idea, your question is far too general. You need to do some research to see what features are available with whatever software you plan to use.
|
|
|
|
|
okay....
sir i want to add text box, all shapes ,in panel like select and drop onto panel and this are stretchable and this panel size set by me for printing size as ID Card can i set this??? pls help me
thank you
|
|
|
|
|
Member 13123466 wrote: pls help me How? We have no idea what your program is doing or where you have a problem. If you do not understand the basics of laying out controls on a form then you should go to the Articles section and do some research.
|
|
|
|
|
Is there a way to re-direct the output of a ?wsdl to a listbox?
for example, I'd like to add a button that invokes the following:
http://serverName:port/service.svc?wsdl
and send the output to a listbox
many thanX
|
|
|
|
|
Yes, you would need to parse the response into whatever separate items you want, and then add each one to the listbox.
|
|
|
|
|
Hi,
I need to create a program to ask the user about 20 integers and find the highest number using for-loops and arrays. The code I've created is not working since it's not giving me the highest number. Can someone please advise me on what to do/change?
//======MY CODE======
int[] tal = new int[20];
for (int i = 0; i < 20; i++)
{
Console.WriteLine("Skriv ett nummer: ");
string strNr = Console.ReadLine();
int nr = Convert.ToInt32(strNr);
tal[i] = nr;
}
int largest = 0;
for (int i = 0; i < tal.Length -1; i++)
{
if (i > largest)
largest = i;
}
Console.WriteLine("Det största talet är: ", largest);
Console.ReadKey();
|
|
|
|
|
The code is finding the highest index up to tal.Length -1 . Both of those things are the wrong thing to do.
|
|
|
|
|
Your loop is not counting to the end, and is comparing the wrong item. It should be:
for (int i = 0; i < tal.Length; i++)
{
if (tal[i] > largest)
largest = tal[i];
}
|
|
|
|
|
So I'm working on scavenging data from a vendor supplied product that uses an Access DB as its method of data storage. Since it's Access and they know it's not really an efficient database, they do all kinds of weird things in handling their data. They delete anything over 3 days old and they don't use the ID field as you would expect. So what I'm looking to do is pull new values once a minute or so based upon the timestamp. The problem comes in with Daylight Savings and the time changes. So to work around this, I'm thinking of converting to UTC to do the comparison using one of these two methods:
DateTime.ToUniversalTime Method (System)[^]
TimeZoneInfo.ConvertTimeToUtc Method (DateTime, TimeZoneInfo) (System)[^]
I'm worried that I'm going the overkill route though. Anyone have any thoughts?
modified 15-May-17 13:13pm.
|
|
|
|
|
How are the dates stored in the database? NB: they should be stored as DateTime types, i.e. UTC.
|
|
|
|
|
It's Access. So I'm assuming the worst.
|
|
|
|
|
My first thought would be: what time zone is used when the data is inserted or updated in the database?
If it's the local time zone on the computer that's running the application, then you might struggle. There's no guarantee that they're all set to use the same time zone, or that their clocks are properly synchronized. And once the value is in the Access database, you've lost all time zone information.
If all the computers are in a domain - and all in the same time zone - you might be able to use Group Policy to manage the time zone:
windows - Setting time zones with site-based Group Policy - Super User[^]
Domain-joined computers will probably be set to synchronize their clocks with the domain controller, so you should be OK.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Luckily the application and the data will be on the same computer. I think that by using the second method, which is able to get the local timezone info and convert it to UTC, I'll be able to avoid that mess.
|
|
|
|
|
Hi,
When I try the following code, I receive an error which says:
Newtonsoft.Json.JsonSerializationException: 'Cannot deserialize the current JSON object (e.g. {"name":"value"}) into type 'System.Collections.Generic.List`1[Test.Program+NewsItem]' because the type requires a JSON array (e.g. [1,2,3]) to deserialize correctly.
To fix this error either change the JSON to a JSON array (e.g. [1,2,3]) or change the deserialized type so that it is a normal .NET type (e.g. not a primitive type like integer, not a collection type like an array or List<T>) that can be deserialized from a JSON object. JsonObjectAttribute can also be added to the type to force it to deserialize from a JSON object.
Path 'data', line 2, position 8.'
On this line:
List<NewsItem> items = JsonConvert.DeserializeObject<List<NewsItem>>(json);
Here is my Code:
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using System.Web.Script.Serialization;
namespace Test
{
public class Program
{
public class News
{
public IList<NewsItem> data { get; set; }
}
public class NewsItem
{
public IList<string> title { get; set; }
public IList<string> body { get; set; }
}
public static void Main(string[] args)
{
string json = "";
using (StreamReader r = new StreamReader("data3.json"))
{
json = r.ReadToEnd();
List<NewsItem> items = JsonConvert.DeserializeObject<List<NewsItem>>(json);
}
List <News> allNews = new System.Web.Script.Serialization.JavaScriptSerializer().Deserialize<List<News>>(json);
foreach (var item in allNews)
{
foreach (var record in item.data)
{
Console.WriteLine(record.title);
Console.WriteLine(record.body);
}
Console.ReadLine();
}
}
}
}
And here is my JSON sample object:
{
"data": [{
"body": ["<p>part 1-1</p>", "<p>part 1-2</p>"],
"link": "http://www.test.com",
"title": ["sample title 1"]
},
{
"body": ["<p>part 2-1</p>", "<p>part 2-2</p>"],
"link": "http://www.test.com",
"title": ["sample title 2"]
}
]
}
Thank you in advance for your time and consideration.
|
|
|
|
|
Your data tag in the JSON is not an array yet your C# code it treating it as one.
|
|
|
|
|
Your NewsItem class is missing a definition of the link JSON entry.
|
|
|
|