.vcf file not opening - outlook

I am trying to create a .vcf file programmatically in C#, and writing a bunch of strings in the correct format in that file. But when i try to open it manually, the following message appears. Could not start Microsoft Outlook.The file maynot exist, you may not have permission to open it, or it may be open in another program.
But when i create a text file manually write the same bunch of strings in the vcard format and change the extension to .vcf and then open the file, it opens properly with outlook
Any help!!!

You don't say so explicitly, so I have to ask: have you elimated all of the suggestions Outlook gives you? The file isn't currently still open with a lock by your program? The file permissions are such that it can be read by the outlook user? The file does exist?

This reply may help someone. I got a similar error, the problem for me was that there was no data in the vcf file. As soon as i printed the VCARD info after the headers (and then opened the resultant vcf file) the error disappeared.
My error

Verify you used CrLf for line terminiators in your code. If you use Environment.NewLine or just \n's, that may be the problem.

You probably saved the file as UTF-8 or Unicode. To test, open the file in VS in binary, delete the first three bytes and see if the file opens.

Had a very similar problem when constructing a .vcf file from a vCard string. The contact form would be completely blank when opening in Outlook. I solved the problem by converting the string to a UTF8 Encoded Byte Array.
byte[] vCard = System.Text.UTF8Encoding.UTF8.GetBytes(vCardString);

Related

Is there integrity check in PE files?

I am trying to edit some portable executable file with text editor.
In the top of the file a backward compatibility string is supposed to display messages on DOS systems.
This program cannot be run in DOS mode.(click the link to see screenshot)
I first tried to edit this string by replacing a char (not removing or adding : just replacing to not change the file size). Then when I try to execute the file windows return an error saying I can't run this app on my computer.
I also tried to edit the padding at the very end of the file and the error is the same.
I suppose an integrity check is performed. Did someone already read about this? If you did, do you know if/where the file hash is stored in it?
A text editor is not appropriate for editing binary files. Use a hex editor instead.

File encrypt by format

I am new to computers, and I want to know if there is a way to make files two-format-usable. For example, there is a jpg format file, but actually it is a docx format file, and we can decode it by changing the file format from .jpg to .docx. Can anyone help me? Thanks!!!
Changing the file extension does not change the file data or format. It does keep some programs from opening the file.
This is done often on .zip files, changing the file extension to something different. This just adds confusion, not security.
If you want security encrypt the file data with a key and use any extension you choose. The password can be something you enter on encryption and again of later opening that will decrypt the file.

Not able to open vb6 output file

I am new to Visual basic 6 and I use it to run a code (not written by me) for my data analysis. One of the output file is tmaze1.1.rmap
I am not able to open this file. what I know is, it has values in a 64 by 48 array.
I tried opening it through notepad, wordpad etc but it only shows symbols.
Please help.
Thanks.
Try opening the file with a Hex editor. Google "free hex editor" to download one if you don't already have one installed. The Hex editor will allow you to read the values inside the file.

Mac Terminal: How to view a microsoft word file? (It says it is binary)

So I was writing a paper on Microsoft Word and the file is corrupt now. I'm trying to see if I can open the file using vim, but it says it is binary. Is there any command or any way to convert it into text so that I can just vim myfile.doc and copy the text contents? I tried doing a cp myfile.doc myfile.txt to change the extension but it still says it's binary.
A doc file is a proprietary format by Microsoft. Docx formats are xml based but neither can be read directly using a text editor. If your file is corrupt you're probably going to have a lot more luck try to find the autosave location or try and recover the document using the tool office provides. In future remember to back up your work ;)
/usr/bin/strings may be helpful -- built-in to OS X. Hope you can recover your paper.
.doc or .docx is not a plane txt file. It has several formatting and a bit of binary and in .docx xml factor included.
You can go for OpenOffice which is Free.
You might try using Antiword to convert to .txt if it can still access the file properly.
http://en.wikipedia.org/wiki/Antiword
Word itself has an option to "Recover Text From Any File" which is worth trying if you haven't done so already. When you open the file in Word, if it doesn't recognise the format, you should see a conversion dialog and the option is in there. You might have to check the "Confirm conversion at open" option (e.g. "Word Preferences->General->Confirm conversion at open" on Mac Word 2011, "File->Options->Advanced->General->Confirm file format conversion on open" on Windows Word 2010.

Excel .xlsx download - sharing violation error message on Open and Save combination

I've found this question posed a few times, but no definitive answers as yet. Looks like a decent solution would help quite a few people.
So we create an excel file (.xlsx) on the server and download it to the client using content-disposition 'attachment'. The Open Save dialog appears and all works fine if you choose Save, or Open and then Save As... However if you choose Open and then hit the Save... button then Excel hangs for a moment and then presents the message:
Your changes could not be saved to 'Export[5].xlsx' because of a sharing violation. Try saving to a different file.
then:
The file you are trying to open 'F8CAC020.IE5\HM2NBE5C\F8CAC020', is in a different format than specified by the file extension. Verify that the file is not corrupted and is from a trusted source before opening the file. Do you want to open the file now?
then:
you finally get the Save As: dialog (assuming you pressed 'Yes').
Code for creating the file is:
Response.Clear()
Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
Response.AppendHeader("content-disposition", "attachment;filename=Export.xlsx")
Response.AddHeader("Content-Length", New System.IO.FileInfo(NewFile).Length)
Response.TransmitFile(NewFile)
Response.Flush()
If you remove the content-disposition header you get the right sort of behaviour in Excel, but with the wrong name and no guarantee that the Excel document will not instead be shown in the browser (depending on client settings). If you press Open and then Save then you
get a message:
'default.aspx' is read-only. To save a copy, click OK, then give the workbook a new name in the Save As dialog box.
So the question is how to combine the 2 behaviours into a reasonable one:
Get the nice error message directly above, when you try to Open and then Save a downloaded file, but also specify that the document should be downloaded and given a default filename.
Cheers,
James
I believe there is a bug in the IE file download code that does not acknowledge the completed file transfer (download) from the web server, thus leaving a connection to the downloaded (temporary) file open when the save is attempted. That generates the "sharing violation" message. I tried the same code with FireFox and I don't get the same result, which surely leads me to believe this is an IE-specific problem.
Unfortunately, given that I believe this to be a bug in IE, I don't think there is presently a clean resolution to this issue.

Resources