Is it a bad idea for a file name to contain space and capital letters? When naming a file, (for example in OneDrive) is it a bad idea for the name to contain space and capital letters? Is there any potential conflicts it might cause? Should I use hyphen or underscore instead?
Certain characters and special words aren't allowed and can make a file name or folder name invalid and unacceptable to OneDrive:

Certain characters have special meaning and thus aren't allowed - &quot; * : &lt; &gt; ? / \

On OneDrive with Sharepoint, these aren't allowed - ~ &quot; # % &amp; * : &lt; &gt; ? / \ { | }.

Leading (before the filename) and trailing (after the filename) spaces in file or folder names also aren't allowed. If you're using Office 2010, you can't use &quot;&amp;&quot; in file and folder names.

These names aren't allowed for files or folders: .lock, CON, PRN, AUX, NUL, COM0 - COM9, LPT0 - LPT9, _vti_, desktop.ini; filenames also cannot start with ~$.

&quot;_vti_&quot; cannot appear anywhere in a file name.


Source: Invalid file names and file types in OneDrive and SharePoint.
So, while spaces are certainly allowed in the name, you have to be careful there is no space before or after the name. Both hyphen and underscore are also allowed.
While spaces aren't likely to cause any issues, as others have pointed out, it is easier to type hypens or underscore in a Terminal command. Many advanced users thus tend to avoid spaces and use hyphens or underscores in general. In general though, spaces in names should not cause any issue with MS Office or OneNote.